Graphics / Playgrounds / DDA vs Bresenham
DDA vs Bresenham draft
DDA vs Bresenham opens on DDA so you can trace one segment, then switch methods while keeping the same endpoints. Use Step, Back, Run and Reset to compare the floating-point state carried by DDA with the error state used by Bresenham, or switch to the floating-endpoint form to inspect its initialisation.
- m
- (y1 - y0)/(x1 - x0) = 0.444
- yi
- y0 = 1
- x = 1: yi = y0 = 1; y = round(yi) = 1
- x = 2: yi = yi + m = 1.444; y = round(yi) = 1
- x = 3: yi = yi + m = 1.889; y = round(yi) = 2
- x = 4: yi = yi + m = 2.333; y = round(yi) = 2
- x = 5: yi = yi + m = 2.778; y = round(yi) = 3
- x = 6: yi = yi + m = 3.222; y = round(yi) = 3
- x = 7: yi = yi + m = 3.667; y = round(yi) = 4
- x = 8: yi = yi + m = 4.111; y = round(yi) = 4
- x = 9: yi = yi + m = 4.556; y = round(yi) = 5
- x = 10: yi = yi + m = 5; y = round(yi) = 5
0 / 10