line drawing algorithm

Explain DDA line drawing algorithm in detail.Can line segment represented by points P1(6,10) & P2(20,30) be drawn using DDA algorithm? Explain?
However, this algorithm does not lead to integer arithmetic. Scaling by: 2* dx
void Bresenham (int xl, int yl, int xr, int yr)
{
int x,y; /* coordinates of pixel being drawn */
int dy, dx;
int ne; /* integer scaled error term */
x = xl; y = yl; /* start at left endpoint */
ie = 2 * dy - dx; /* initialize the error term */
while (x <= xr){ /* pixel-drawing loop */
PlotPixel (x,y); /* draw the pixel */
if (ie > 0) {
y = y + 1;
ne = ne - 2 * dx; /* replaces e = e - 1 */
}
x = x + 1;
ne = ne + 2 * dy; /* replaces e = e + m */
}
}
Topic archived. No new replies allowed.