Fourth
By: a guest | Dec 22nd, 2009 | Syntax:
C++ | Size: 0.49 KB | Hits: 1,606 | Expires: Never
/*
** Author: Nicholas Forysinski
*/
/*
** drawLine
**
** Draw a line from vertex (x0,y0) to vertex (x1,y1) using
** the midpoint line algorithm (as discussed in class).
*/
void drawLine {
if( dx > dy ) {
x = x0
foreach step until x>=x1 {
draw a pixel
adjust d and y values
}
} else {
y = y0
for each step while y != y1 {
draw a pixel
adjust d and x values
}
}
}