Primitive Line Drawing Algorthms Flashcards
1
Q
What is DDA?
A
Digital difference analyzer.
2
Q
What is the basic idea of DDA?
A
To calculate x or y by looking at delta x or delta y sampled at unit intervals.
3
Q
What is Bresenham’s Algorithm?
A
An algorithm to calculate a line using only integer math.
4
Q
What are the five steps of Bresenham’s Algorithm?
A
- Get endpoints, left endpoints (x0, y0)
- Plot (x0, y0)
- Calculate constants, dx, dy, 2dy, 2dy-2dx, decision parameter p0 = 2dy-dx.
- fpr each x if p < 0 go east and p = p + 2dy if p > 0 go northeast and p = p + 2dy - 2dx.
- Repeat 4 until done.