CS 248: Introduction to Computer Graphics
Pat Hanrahan
Grader: Reid
5. (10 points) Circle Drawing
Answer:
sector(int r)
{
int x = r;
int y = 0;
e = r;
dedy = 1;
dedx = 2  r  r;
while( x > y ) {
point( x, y );
e += dedy;
dedy += 2
y += 1;
if ( e >= 0 ) {
e += dedx;
dedx += 2;
x = 1;
}
}
}
Scoring:

10 points for the correct answer for either the algorithm originally presented
or the corrected version presented during the midterm.

5 points for a deriving the finite difference step but not correctly
coding the new finite difference steps.

2 points if additional adds in the "e += dedx" and "e += dedy" step.

1 point if the sign in the "dedx += 2" step is incorrect.
Copyright © 1997 Pat Hanrahan