Fall 2015, Final Exam.
Wikipedia gives the following lighting equation: And the accompanying diagram
Line1(p1, p2)
- m = (y2-y1)/(x2-x1)
- x = x1
- y = y1
- while x ≤ x2 do
- plot(x,y)
- x += 1
- y += m
DDA(p1, p2)
- dx = x2-x1
- dy = y2-y1
- x = x1
- y = y1
- if |dx| < |dy|
- while y ≤ y2
- plot(x,y)
- x += dx/dy
- y = y + 1
- else
- while x ≤ x2
- plot(x,y)
- x += 1
- y += dy/dx