DDA : Digital Differential Analyzer
The dda is scan-conversion line algorithm based on calculating dx and dy.
DDA algorithm
DDA(int xa, int ya,int xb,int yb)
{
x = xa
y = ya
dx = xb - xa
dy = yb - ya
if (abs(dx) > abs(dy)) then
{
steps = abs(dx)
}
else
{
steps = abs(dy)
}
putpixel (xa,ya,1)
int xinc = dx/steps
int yinc = dy/steps
for ( i=1 to steps )
{
x = x + xinc
y = y + yinc
putpixel ( round(x),round(y),1 )
}
}
round (a)
{
return ( int ( a + 0.5 ) )
}
The dda is scan-conversion line algorithm based on calculating dx and dy.
DDA algorithm
DDA(int xa, int ya,int xb,int yb)
{
x = xa
y = ya
dx = xb - xa
dy = yb - ya
if (abs(dx) > abs(dy)) then
{
steps = abs(dx)
}
else
{
steps = abs(dy)
}
putpixel (xa,ya,1)
int xinc = dx/steps
int yinc = dy/steps
for ( i=1 to steps )
{
x = x + xinc
y = y + yinc
putpixel ( round(x),round(y),1 )
}
}
round (a)
{
return ( int ( a + 0.5 ) )
}
Nice (y)
ReplyDelete