x = x1
while x <= x2
WritePixel(x,y,c)
if d > 0
y = y + 1
d = d - 2*dx
end if
d = d + 2*dy
x++
- [3 points] What are the types of all of the variables? (x,y,d, dx, dy)
- [5 points] What does the variable $d$ represent?
- [3 points] What should $d$ be initialized to be (idea, not exact value)?
- [3 points] Why is only the sign of $d$ considered?
- [6 points] Draw a diagram representing $(x_{old}, y_{old}), (x_{new}, y_{new})$ and $d$