L-7 (Ellipse Drawing Algorithm_1) (1)
L-7 (Ellipse Drawing Algorithm_1) (1)
Polynomial Method
The ellipse has a major and minor axis. If a and b a re major and minor axis
respectively. The centre of ellipse is (i, j). The value of x will be
incremented from i to a and value of y will be calculated using the
following formula
( x i)2
y b 1 2
j
a
Drawback of Polynomial Method
It requires squaring of values. So floating point calculation is required.
Routines developed for such calculations are very complex and slow.
.
Polynomial Method
Algorithm
Step 1: Set the initial variables: a = length of major axis; b = length of
minor axis; (h, k) = coordinates of ellipse center; x = 0; i = step; x end = a.
Step 2. Test to determine whether the entire ellipse has been scan-
converted. If x > xend, stop.
Step 3. Compute the value of the y coordinate:
x2
y b 1 2
a
Step 4: Plot the four points, found by symmetry, at the current (x, y)
coordinates:
Plot (x + h, y + k) Plot (-x + h, -y + k)
Plot (-y + h, x + k) Plot (y + h, -x + k)
Step 5. Increment x; x = x + i. Step 6. Go to step 2.
.
Trigonometric Method
The following equation defines
an ellipse trigonometrically as
shown in fig:
x = a * cos (θ) +h and
y = b * sin (θ)+k
where (x, y) = the current
coordinates
a = length of major axis
b = length of minor axis
θ= current angle
(h, k) = ellipse center
In this method, the value of θ is
varied from 0 to PI/2 radians.
The remaining points are found
by symmetry.
.
Trigonometric Method
Drawback
This is an inefficient method.
It is not an interactive method for generating ellipse.
The table is required to see the trigonometric value.
Memory is required to store the value of θ.
.
0 if ( x, y ) inside
f ( x, y ) b 2 x 2 a 2 y 2 a 2b 2 0 if ( x, y ) on
0 if ( x, y ) outside
.
next pixel. The midpoint of T & S is used to define the following decision
parameter.
.