0% found this document useful (0 votes)
40 views

Lecture#3 Point Circle Algorithm

The document describes the point circle algorithm for generating the points along the circumference of a circle given a radius. It explains how to calculate the decision parameter pk to determine whether the next point should move to yk or yk-1 as it traverses the octants. An example is provided of applying the algorithm to draw a circle with radius 8 by calculating the x and y coordinates at each step based on the decision parameter pk.

Uploaded by

fuxail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Lecture#3 Point Circle Algorithm

The document describes the point circle algorithm for generating the points along the circumference of a circle given a radius. It explains how to calculate the decision parameter pk to determine whether the next point should move to yk or yk-1 as it traverses the octants. An example is provided of applying the algorithm to draw a circle with radius 8 by calculating the x and y coordinates at each step based on the decision parameter pk.

Uploaded by

fuxail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Computer Graphics 2k17BSCS CE-311

Lecture 3
Point Circle Algorithm
(0,r)
x≥y
O8 O1

O7 O2

(-r,0) (r,0)

O6 O3

O5 O4

(0,-r)
Point Circle Algorithm
• The first task is to find the (0,r)
points on the circumference x≥y
O8 O1
of Octet-1
• This octet starts from (0,r) to
O7 O2
the point where x ≥ y
• x moves in unit intervals (-r,0) (r,0)
• xk+1 = xk+1
O6 O3
• We need to find whether to
move to yk or yk-1 because O4
O5
we are moving downward in
first octet. (0,-r)
• yk+1 = yk OR yk+1 = yk-1
Point Circle Algorithm
• x2 + y2 = r2 OR x2 + y2 - r2 = 0
• If the starting point is (xk,yk) then next point on circle (moving
downward in the first octet) will be either of the two
• (xk+1 , yk) OR (xk+1 , yk-1)
• Mid point : (xk+1 , yk – ½)
• Decision Parameter (pk) to select either (xk+1 , yk) OR (xk+1 , yk-1) ?
• Can be found by substituting this mid point in the circle equation
• pk = x2 + y2 - r2
• pk = (xk+1)2 + (yk – ½)2 – r2
• pk+1 = (xk+1+1)2 + (yk+1 – ½)2 – r2
Point Circle Algorithm
pk+1 – pk = (xk+1+1)2 + (yk+1 – ½)2 – r2 – [(xk+1)2 + (yk – ½)2 – r2]
pk+1 – pk = (xk+1+1)2 + (yk+1 – ½)2 – r2 – [(xk+1)2 + (yk – ½)2 – r2]
pk+1 – pk = ((xk+1)+1)2 + (yk+1 – ½)2 – r2 – [(xk+1)2 + (yk – ½)2 – r2]
pk+1 – pk = (xk+1)2+1+2(xk+1) + yk+12 + ¼ –yk+1 – r2
– [(xk+1)2 + yk2 + ¼ -yk – r2]
pk+1 – pk = (xk+1)2+1+2(xk+1) + yk+12 + ¼ – yk+1 – r2
– (xk+1)2 – yk2 – ¼ +yk + r2
pk+1 – pk = (xk+1)2+1+2(xk+1) + yk+12 + ¼ – yk+1 – r2
– (xk+1)2 – yk2 – ¼ +yk + r2
pk+1 – pk = 2(xk+1) + (yk+12 – yk2) – (yk+1 – yk) + 1
pk+1 = pk + 2(xk+1) + (yk+12 – yk2) – (yk+1 – yk) + 1
(0,r)
Point Circle Algorithm x≥y
O8 O1
• pk = (xk+1)2 + (yk – ½)2 – r2
• If initial point is (0,r) then decision O7 O2
parameter is given by
• pk = (0+1)2 + (r – ½)2 – r2 (-r,0) (r,0)

• pk = 1 + r2 + ¼ – r – r2 O6 O3

• pk = 1 + ¼ – r = 5/4 – r
O5 O4
• pk = 1 – r (0,-r)
Point Circle Algorithm
• pk+1 = pk + 2(xk+1) + (yk+12 – yk2) – (yk+1 – yk) + 1
• pk = 1 – r (0,r)
x≥y
• First octet points must be within the limit O8 O1
before the condition x ≥ y
• Starting from (0,r) O7 O2
if pk≥0 then if pk<0 then (-r,0) (r,0)
yk+1 = yk–1 yk+1 = yk
O6 O3
so next point so next point
will be will be
O5 O4
(xk+1, yk–1) (xk+1, yk)
(0,-r)
Point Circle Algorithm – Example
• Drawing a circle with radius 8
k xk yk pk xk+1 yk+1 pk+1 (0,8)
x≥y
O8 O1
0 0 8
1 O7 O2
2
(-8,0) (8,0)
3
O6 O3
4
5
O5 O4
6
(0,-8)
Q1 Q2 Q3 Q4
(0,8)
x≥y
O8 O1

O7 O2

(-8,0) (8,0)

O6 O3

O5 O4
(0,-8)

You might also like