Circle
Circle
represents a point on the circle. The algorithm is based on the idea of symmetry and
efficiently calculates the points of the circle by determining their positions based on the
midpoint of the circle's circumference.
1. Initialization:
o Define the center of the circle at (x_c, y_c).
o Define the radius of the circle as r.
o Set the initial point to (0, r) [setting x = 0, y = r]
2. Plotting Points Using Symmetry:
o Calculate the decision parameter, often denoted as P, using the midpoint circle
algorithm decision parameter:
P=1−r
While plotting the circle, start at the initial point and move along the
circumference using symmetry:
▪ At each step, choose the next point based on the current decision
parameter:
▪ If P < 0, the next point is on the same horizontal line and closer
to the midpoint in the x-direction. Update P as:
Pnext=P+2x+1
Pnext=P+2x+1−2y
The algorithm is efficient because it uses symmetry properties to calculate only a portion of
the circle (usually one-eighth or one quadrant) and then mirrors the points to complete the
circle. This reduces the number of calculations needed compared to other methods that
calculate all points directly.
1. Initialization:
o Define the center of the circle at (x_c, y_c).
o Define the radius of the circle as r.
o Set the initial point to (0, -r). [setting x = 0, y = -r]
2. Plotting Points Using Symmetry:
o Calculate the decision parameter, often denoted as P, using the midpoint circle
algorithm decision parameter:
P=1+r
o While plotting the circle, start at the initial point and move along the
circumference using symmetry:
▪ At each step, choose the next point based on the current decision
parameter:
▪ If P < 0, the next point is on the same horizontal line and closer
to the midpoint in the x-direction. Update P as:
Pnext=P+2y+1
Pnext=P+2y+1−2x
1. Initialization:
o Define the center of the circle at (x_c, y_c) as (R, 0).
o Define the radius of the circle as r.
o Set the initial point to (R, 0).
2. Plotting Points Using Symmetry:
o Calculate the decision parameter, often denoted as P, using the midpoint circle
algorithm decision parameter:
P=1−r
Pnext=P+2x+1
Pnext=P+2x+1−2y