Closed Drincann closed 1 year ago
In fact, in the expression y0(1.-t) + y1t there are two casts from floating point to int, the addition is integer. Therefore, there are more rounding errors than in the first one y0 + (y1-y0)*t
There is a pedagogical interest though to write y0(1.-t) + y1t because 1-t and t are barycentric coordinates of the current point w.r.t the segment (x0,y0) - (x1,y1), and this prepares ground for the barycentric coordinates in a triangle
Thank you, great repository!
In Second attempt - lesson 1, the expession used to calculate y changes as follows:
Using the expression used in the second attempt, I found an exception when drawing a line with no slope (vertical). This line jitters back and forth within two pixels in the x direction like:
impl:
calling: