Advanced C++ Programming Tutorial 1

From Chilipedia
Jump to: navigation, search

In this video, we learn to draw straight lines (not homophobic) between any 2 points. Seriously though, linear equations permeate pretty much all of the things, so you might as well invest some timemoneybucks into not being utter shit at them.


  • Linear equations (y=mx+b)
  • Line rasterization

Video Timestamp Index

Tutorial 1



For the homework, solve the following math problems. All the problems should be solved algebraically where possible (i.e. not by simply graphing and observing). Feel free to take a break or two along the way.

  1. Plot the line y=(6/9)x+3.
  2. Determine whether the following points are on the line y=(6/9)x+3:
    1. (-2,1)
    2. (3,5)
  3. Find the point of intersection of the lines y=(6/9)x+3 and y=2x+7.
  4. Determine whether these two line segments intersect and where: (0,7)--(4,15) and (-6,-1)--(6,7).
  5. Find the equation of the line that is perpendicular to y=(6/9)x+3 and intersects it at x=3.
  6. Find the midpoint between (-5,-3) and (0,7).
  7. Find the perpendicular bisector line segment to make a "perfect X" with line segment (-5,-3)--(0,7) (here, perfect X means both line segments are same length).
  8. Find the closest point on the line y=(6/9)x+3 to the point (5,2).
  9. Find the distance between the point (5,2) and the line y=(6/9)x+3.
  10. Determine whether the circle of radius 5 at (5,2) intersects with the line y=(6/9)x+3.
  11. Determine whether the circle of radius 5 at (5,2) intersects with the line segment (6,7)--(12,11).
  12. Find points of intersection between the circle of radius 5 at (5,2) and the line y=(6/9)x+3.
  13. Find the value that is 20% on the way from 4.2 to 6.9.
  14. Find the point that is 69% from (6,9) to (4,20).
  15. Find the color C3 that is a blend 69% from C1 (42,230,156) to C2 (200,60,200).
  16. You have a horizontal UI slider that has an x range of 223 to 273. It controls a strength value ranging from 5 to 100.
    1. Find the mathematical function that computes the strength value given the x position of the slider.
    2. The damage value for an attack is calculated as dmg=(3/2)str+10. Find the function that computes attack damage given the slider position.

Solution Videos

Since there is an asston of questions, I had to split up the solution into 4 motherfucking videos (you're welcome).

  1. Solutions: Q1-Q4
  2. Solutions: Q5-Q8
  3. Solutions: Q9-Q12
  4. Solutions: Q13-Q16

See also