Lecture 6 Circle Drawing Algorithm
Lecture 6 Circle Drawing Algorithm
Defining a Circle
Circle is an eight-way symmetric figure.
The shape of circle is the same in all quadrants. In each quadrant, there are
two octants.
If the calculation of the point of one octant is done, then the other seven
points can be calculated easily by using the concept of eight-way
symmetry.
For drawing circle, considers it at the origin. If a point is P1(x, y), then the
other seven points will be given as follows.
So we will calculate only 45° arc. From which the whole circle can be
determined easily.
.
Defining a Circle
.
Defining a Circle
If we want to display circle on screen then the putpixel function is used for
eight points as shown below:
putpixel (x, y, color)
putpixel (x, -y, color)
putpixel (-x, y, color)
putpixel (-x, -y, color)
putpixel (y, x, color)
putpixel (y, -x, color)
putpixel (-y, x, color)
putpixel (-y, -x, color)
Eight-way symmetry of circle
.
Defining a Circle
Example: Let we determine a point (2, 7) of the circle then other points
will be (2, -7), (-2, -7), (-2, 7), (7, 2), (-7, 2), (-7, -2), (7, -2)
These seven points are calculated by using the property of reflection. The
reflection is accomplished by reversing (x, y) co-ordinates.
There are two standards methods of mathematically defining a circle
centered at the origin. Defining a circle using Polynomial Method and
Defining a circle using Polar Co-ordinates
.
Now, consider the coordinates of the point halfway between pixel T and
pixel S
This is called midpoint (xi+1,yi-1/2) and we use it to define a decision
parameter:
.