0% found this document useful (0 votes)
104 views24 pages

Scan Converting Ellipse Algorithm: by Amjad Khan Khalil Amjad@aup - Edu.pk

The document describes Bresenham's midpoint circle algorithm adapted for drawing ellipses. It divides the ellipse into two regions based on slope and uses different decision variables for each region to determine the next pixel along the ellipse curve. Region I uses the lower or upper pixel based on distance from midpoint. Region II uses left or right pixel. Examples are provided to demonstrate determining the next pixel position.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views24 pages

Scan Converting Ellipse Algorithm: by Amjad Khan Khalil Amjad@aup - Edu.pk

The document describes Bresenham's midpoint circle algorithm adapted for drawing ellipses. It divides the ellipse into two regions based on slope and uses different decision variables for each region to determine the next pixel along the ellipse curve. Region I uses the lower or upper pixel based on distance from midpoint. Region II uses left or right pixel. Examples are provided to demonstrate determining the next pixel position.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Scan Converting Ellipse

Algorithm

By
Amjad Khan Khalil
[email protected]
Ellipse
 Its is the set of points where the sum of distances of
each point from the focii points remains the same.
 Ellipse is an elongated circle therefore an elliptical
curve can be drawn by modifying the circle drawing
procedures to take into an account the different
dimensions of an ellipse along the major and minor
axes.
 The mid point algorithm is used for drawing an
ellipse is based on the selection of most favorable
point on the ellipse which depend upon the decision
variables and the value calculated on the mid point.
Mid point Ellipse algorithm

2a is the length of the major axis


along the x axis.
2b is the length of the minor axis
along the y axis.
The midpoint can also be applied to
ellipses.
For simplicity, we draw only the arc of
the ellipse that lies in the first
quadrant, the other three quadrants
can be drawn by symmetry
Mid point Ellipse algorithm
 First we draw the arc of the ellipse
which lies in the first quadrant and the
next three will be drawn by symmetry.
 We divide the first quadrant into two
regions. The boundary between the two
regions is the point where the slope of
the tangent line to the curve is -1.
Scan Converting Ellipse:
Algorithm

j > i in region 1

j < i in region 2
Con’t
 As we know that the ellipse equation is
x2/a2+y2/b2=1
Or we can say that
f(x, y)= b2x2+a2y2-a2b2
Differentiate the above equation w.r.t x we get
a2y=b2x
Which show the boundary of region-I and
region-II
Con’t
 If a2y> b2x then it means that we are
in region-I

 If a2y<b2x then it means that we are in


region-II
Examples
 If P(5,4) is a point located on Ellipse then
find out the region if value of major axis is
5 and minor axis is 4
 Find out the region of a point P(6,4)
located on ellipse if a=4 and b=3
 If P(8,2) is a point located on Ellipse then
find out the region if value of major axis is
6 and minor axis is 3
Region-I
Region-I
If we start from pixel(xp, yp) then the mid point
coordinates will be
M(xp+1, yp-1/2)
Then dold = a2(yp-1/2)2+b2(xp+1)2-a2b2 A
Region-I (Case-I)
 If dold>0 then it means that the mid
point is outside the ellipse so the line
passes near the lower pixel therefore
the lower pixel is selected and the
decision parameters for the next pixel is
as under:
M(xp+2, yp-3/2)
Thus
dnew= a2(yp-3/2)2+b2(xp+2)2-a2b2 B
Con’t
 Thus by subtracting eq(A) from eq(B)
we get the following equation

dnew=dold-2a2(yp-1)+b2(3+2xp)
Region-I Case(II)
 If dold < 0 then it means that the mid point
is inside the ellipse and the ellipse passes
near the upper pixel and thus upper pixel is
selected and the decision parameters for the
next pixel position is as under
M(xp+2, yp-1/2)
Thus
dnew= a2(yp-1/2)2+b2(xp+2)2-a2b2 c
Con’t
Thus subtracting eq(A) from eq(C) we
get the following equation

dnew=dold+b2(2xp+3)
Region-I Case-III
 If dold=0 then the ellipse passes
through the mid point and thus is at
equal distance from both of the pixels
and we can select any pixel in this case.
 If you select the lower pixel then use
case-I.
 If you select the upper pixel then use
case-II
Region-II
 In region-II the geometry of the line is more
vertical as compare to region-I and thus
using the mid point algorithm we have to
choose mid point between left and right
pixels
 If P(xp,yp) is the starting pixel then the mid
point coordinates will be
M(xp+1/2, yp-1)
Thus the ellipse equation becomes
dold= a2(yp-1)2+b2(xp+1/2)2-a2b2 1
Region-II Case-I
 If dold<0 it means that the point is
inside the ellipse so the ellipse passes
near the right pixel and thus right pixel is
selected and the decision variable for
selecting next pixel position will be
M(xp+3/2, yp-2)
thus
dnew= a2(yp-2)2+b2(xp+3/2)2-a2b2 2
Con’t
 Subtracting eq(1) from eq(2) we get

dnew=dold+a2(3-2yp)+2b2(1+xp)
So if the right pixel R is selected then
the next point position will be computed
using the above equation
Region-II Case-II
If dold>0 then the point is outside the
ellipse and the ellipse passes near the
left pixel so the decision parameters for
next pixel position will be
M(xp+1/2, yp-2)
Thus
dnew= a2(yp-2)2+b2(xp+1/2)2-a2b2 3
Con’t
 By subtracting eq(1) from eq(3) we get

dnew=dold+a2(3-2yp)
So if the left pixel is selected then the
above equation is used to compute the
next pixel position.
Region-II Case-III
 If dold=0 then the ellipse passes
through the mid point and you can
select any of the pixels
 If you select the R pixel then use case-I
 If you select the L pixel then use
case-II
Examples
 Find out the next pixel position using scan
converting ellipse algorithm if the starting
pixel is P(3,5) and value of major axis is 4
and minor axis is 5.
 Find out the coordinates of next pixel using
Bresenham’s Mid point Ellipse algorithm if the
starting pixel is P(5,7) and value of major
axis is 5 and minor axis 6.
Examples
 Using Scan converting Ellipse algorithm find
out the region and position of next two pixels
if the starting pixel is P(4,6) and value of
major axis is 5 and minor axis is 6
 Find out the position of next two pixels using
Bresenham’s Mid point Ellipse algorithm if the
starting pixel is P(2,6) and value of major
axis is 3 and minor is 7.
Examples
 Find out the position of next two pixels
using Bresenham’s Mid point Ellipse
algorithm if the starting pixel is P(2,5) and
value of major axis is 4 and minor is 7.
 Find out the position of next two pixels
using Bresenham’s Mid point Ellipse
algorithm if the starting pixel is P(5,3) and
value of major axis is 6 and minor is 7.

You might also like