Graphics Lecture 04
Graphics Lecture 04
1)
Lecture 4
Circle - Generating Algorithms
2 2
y y c R ( x xc )
• Explicit: y = f(x)
y R 2 x 2
We could draw a quarter circle by
incrementing x from 0 to R in unit
steps and solving for +y for each
step.
• Parametric:
x R cos
y R sin
current
pixel E
ideal
curve M
SE
F (M) < 0 E
E
ideal
curve
M
SE
Decision Variable p
pk 1 Fcirc ( xk 1 1, yk 1 1 )
2
[( xk 1) 1]2 ( yk 1 1 ) 2 r 2
2
recursive definition for successive decision
parameter values p
pk 1 Fcirc ( xk 1 1, yk 1 1 )
2
[( xk 1) 1]2 ( yk 1 1 ) 2 r 2
2
2 2
pk 1 pk 2( xk 1) ( y k 1 y ) ( yk 1 yk ) 1
k
x0 = 0, y0 = r
Initial decision variable found by evaluating circle
function at first midpoint test position
p0 Fcirc (1, r 1 )
2
1 (r 1 2
) r 2
2
5
r
4
For integer radius r p0 can be rounded to p0 =1-r
since all increments are integer.
Midpoint Circle Algorithm (cont.)
Midpoint Circle Algorithm (cont.)
Example
• r=10