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

L-7 (Ellipse Drawing Algorithm_1) (1)

The document discusses various algorithms for generating ellipses, including the Scan Converting Ellipse, Polynomial Method, Trigonometric Method, and Midpoint Ellipse Algorithm. It outlines the definitions, advantages, and drawbacks of each method, emphasizing the mathematical principles behind them. The Midpoint Ellipse Algorithm is highlighted for its incremental approach and similarity to the midpoint circle algorithm.

Uploaded by

somil kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

L-7 (Ellipse Drawing Algorithm_1) (1)

The document discusses various algorithms for generating ellipses, including the Scan Converting Ellipse, Polynomial Method, Trigonometric Method, and Midpoint Ellipse Algorithm. It outlines the definitions, advantages, and drawbacks of each method, emphasizing the mathematical principles behind them. The Midpoint Ellipse Algorithm is highlighted for its incremental approach and similarity to the midpoint circle algorithm.

Uploaded by

somil kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

.

Ellipse Generation Algorithms


 Scan Converting Ellipse
 Polynomial Method
 Trigonometric Method
 Midpoint Ellipse Algorithm
 Scan Converting arcs and sectors
Scan Converting Ellipse
 The ellipse is also a symmetric figure like a circle but is four-way
symmetry rather than eight-way.
 Ellipse is defined as the locus of a point in a plane which moves in a plane
in such a manner that the ratio of its distance from a fixed point called
focus in the same plane to its distance from a fixed straight line called
directrix is always constant, which should always be less than unity.
 There two methods of defining an Ellipse: Polynomial Method of defining
an Ellipse, Trigonometric method of defining an Ellipse
 The midpoint ellipse method is applied throughout the first quadrant in
two parts. Now let us take the start position at (0,b) and step along the
ellipse path in clockwise order throughout the first quadrant.
Scan Converting Ellipse
 The ellipse is also a symmetric figure like a circle but is four-way
symmetry rather than eight-way.
 There two methods of defining an Ellipse: Polynomial Method of defining
an Ellipse, Trigonometric method of defining an Ellipse
.

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 θ.
.

Midpoint Ellipse Algorithm


 This is an incremental method for scan converting an ellipse that is
centered at the origin in standard position i.e., with the major and minor
axis parallel to coordinate system axis.
 It is very similar to the midpoint circle algorithm. Because of the four-way
symmetry property we need to consider the entire elliptical curve in the
first quadrant.
 Let's first rewrite the ellipse equation and define the function ‘f’ that can be
used to decide if the midpoint between two candidate pixels is inside or
outside the ellipse:

  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 
 
.

Midpoint Ellipse Algorithm


.

Midpoint Ellipse Algorithm


 Now divide the elliptical curve from (0, b) to (a, 0) into two parts at point
Q where the slope of the curve is -1.
dy fx
 Slope of the curve is defined by the f(x, y) = 0 is dx

fy
where fx & fy are partial derivatives of f(x, y) with respect to x & y.
 We have fx = 2b2 x, fy=2a2 y &
dy 2b 2 x

dx 2a 2 y
 Hence we can monitor the slope value during the scan conversion process
to detect point Q. Our starting point is (0, b)
 Suppose that the coordinates of the last scan converted pixel upon entering
step i are (xi,yi). We are to select either T ( x 1, y ) or S ( x 1, y  1) to be the
i i i i

next pixel. The midpoint of T & S is used to define the following decision
parameter.
.

Midpoint Ellipse Algorithm


Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm
Mid Point Ellipse Algorithm Example
Mid Point Ellipse Algo: pseudocode
Mid Point Ellipse Algo: pseudocode
Scan converting arcs and sectors
Scan converting arcs and sectors
Scan converting arcs and sectors

You might also like