Digital differential analyzer (graphics algorithm): Difference between revisions

Content deleted Content added
No edit summary
Program: The DDA algorithm requires rounding the floating point x,y to the nearest integer. The sample code should not depend on the behavior of some specific graphics library's putpixel() (for example if it takes int parameters, float->int uses truncation and will produce the wrong answer)
 
Line 72:
 
while (i <= step) {
putpixel(round(x), round(y), 5);
x = x + dx;
y = y + dy;