# WHERE TO DRAW A LINE??

 Line drawing is accomplished by calculating
intermediate positions along the line path between
specified end points.
 Precise definition of line drawing
Given two points P and Q in the plane, both
with integer coordinates, determine which
pixels on a raster screen should be on in order
to make a picture of a unit-width line segment
starting from P and ending at Q.
0 1 2 3 4 5 6
6
5
4
3
2
1
0
(3, 3)
Line drawing (cont)
 The thinnest line is of one-pixel wide. We will
concentrate on drawing a line of 1 pixel resolution.
 The Cartesian slope-intercept equation for a straight
line is
y= m. x + b
m is the slope of the line and b is the y intercept.
Given the endpoints of a line segment.
m = y2-y1 / x2-x1
b= y1-m.x1
Line Drawing (cont)
 Also for any given interval ∆x along a line, we can
compute the corresponding y interval ∆y from
∆y= m. x
 Similarly we can obtain the x interval ∆x
corresponding to a specified ∆y as
∆x= ∆y / m
 These equations form the basis for determining
deflection voltages in analog devices.

Line Drawing (cont)
 Also , for any given x interval ∆x along a line, we
can compute the corresponding y interval ∆y from
∆y= m. ∆ x
 These equations form the basis for determining
deflection voltages in analog devices.
 On Raster systems, lines are plotted with pixels,
and step sizes in the horizontal and vertical
directions are constrained by pixel separations.
Hence we ought to “sample” a line at discrete
positions and determine the nearest pixel to the
line at each sampled position.

Symmetry
 If we could draw lines with positive slope (0<=slope<=1) we
would be done.
 For a line with negative slope (0>=slope>=-1)
We negate all Y values
 For a line with slope > 1 or slope <-1
we just swap x and y axes

45
0
(y,x)
(x,y)
(x,-y)
(y,-x)
(-y,x)
(x,-y)
(-x,-y)
(-y,-x)
Code for drawing a line
Invert_y_draw(int x,int y)

draw_pixel(x,-y)

Swap_xy_draw(int x,int y)

draw_pixel(y,x)

Swap_xy_invert_y_draw(int x,int y)

draw_pixel(y,-x)
……….

If(0 <= slope <= 1)

draw_fn= draw_pixel
draw_lne(Px, PY, QX, QY, draw_fn)

Else if (-1 <= slope <= 0)

draw_fn = invert_y_draw
Draw_line(PX, -PY, QX, -QY, draw_fn)

Else if (1 < slope)

draw_fn= swap_xy_draw
Draw_line(PY,PX,QY,QX)
Else
Draw_fn=swap_xy_invert_y_draw
Draw_line(-PY,PX,QY,-QX, draw_fn)

DDA ALGORITHM
 The digital differential analyzer (DDA) samples the line at unit
intervals in one coordinate corresponding integer values nearest
the line path of the other coordinate.

 The following is thus the basic incremental scan-
conversion(DDA) algorithm for line drawing
for x from x0 to x1
Compute y=mx+b
Draw_fn(x, round(y))
 Major deficiency in the above approach :
 Uses floats
 Has rounding operations

DDA Illustration
(x
i
, Round(y
j
))
(x
i
+1, y
j
+m)
(x
i
, y
j
)
(x
i
+1, Round(y
j
+m))
Desired Line
x1 x2
y2
y1
Bresenham’s Line Algorithm
 An accurate, efficient raster line drawing algorithm
developed by Bresenham, scan converts lines using
only incremental integer calculations that can be
adapted to display circles and other curves.

 Keeping in mind the symmetry property of lines, lets
derive a more efficient way of drawing a line.

Starting from the left end point (x
0
,y
0
) of a given line , we step to
each successive column (x position) and plot the pixel whose
scan-line y value closest to the line path

Assuming we have determined that the pixel at (x
k
,y
k
) is to
be displayed, we next need to decide which pixel to plot in
column x
k+1
.

Bresenham Line Algorithm
(cont)

 The difference between these 2 separations is

 A decision parameter p
k
for the k
th
step in the line
algorithm can be obtained by rearranging above
equation so that it involves only integer calculations

Choices are(x
k
+1, y
k
) and (x
k
+1, y
K
+1)
d
1
= y – y
k
= m(x
k
+ 1) + b – y
k
d
2
= (y
k
+ 1) – y = y
k
+ 1- m(x
k
+ 1) – b

d1-d2 = 2m(xk + 1) – 2 yk + 2b – 1

Bresenham’s Line Algorithm
 Define
P
k
= Δx ( d
1
-d
2
) = 2Δyx
k
-2 Δxy
k
+ c

 The sign of P
k
is the same as the sign of d
1
-d
2
, since Δx > 0.
Parameter c is a constant and has the value 2Δy + Δx(2b-1)
(independent of pixel position)

 If pixel at y
k
is closer to line-path than pixel at y
k
+1
(i.e, if d
1
< d
2
) then p
k
is negative. We plot lower pixel in such a
case. Otherwise , upper pixel will be plotted.

Bresenham’s algorithm (cont)
 At step k + 1, the decision parameter can be evaluated as,
p
k
+1 = 2Δyx
k
+1 - 2Δxy
k
+1 + c

 Taking the difference of p
k+ 1
and p
k
we get the following.
p
k+1
– p
k
= 2Δy(x
k+1
- x
k
)-2Δx(y
k+1
– y
k
)

 But, x
k+1
= x
k
+1, so that
p
k+1
= p
k
+ 2Δy - 2 Δx(y
k+1
– y
k
)

 Where the term y
k+1
-y
k
is either 0 or 1, depending on the sign
of parameter p
k

Bresenham’s Line Algorithm
 The first parameter p
0
is directly computed
p
0
= 2 Δyx
k
- 2 Δxy
k
+ c = 2 Δyx
k
– 2 Δy + Δx (2b-1)

 Since (x
0
,y
0
) satisfies the line equation , we also have
y
0
= Δy/ Δx * x
0
+ b

 Combining the above 2 equations , we will have
p
0
= 2Δy – Δx
The constants 2Δy and 2Δy-2Δx are calculated once for each
time to be scan converted
Bresenham’s Line Algorithm
 So, the arithmetic involves only integer addition and subtraction
of 2 constants

Input the two end points and store the left end
point in (x
0,
y
0
)

0
,y
0
) into the frame buffer (plot the first
point)
Calculate the constants Δx, Δy, 2Δy and 2Δy-2Δx
and obtain the starting value for the decision
parameter as
p
0
= 2Δy- Δx
Bresenham’s Line Algorithm
At each x
k
along the line, starting at k=0, perform the
following test:
If p
k
< 0 , the next point is (x
k
+1, y
k
) and
p
k+1
= p
k
+ 2Δy
Repeat step 4 (above step) Δx times
Otherwise
Point to plot is (x
k
+1, y
k
+1)
p
k+1
= p
k
+ 2Δy - 2Δx

Where do we draw a circle???
Properties of a circle:
 A circle is defined as a set of points that are all the given
distance (x
c
,y
c
). This distance relationship is expressed by the
pythagorean theorem in Cartesian coordinates as
(x – x
c
)
2
+ (y – y
c
)
2
= r
2
 We could use this equation to calculate the points on the circle
circumference by stepping along x-axis in unit steps from x
c
-r to
x
c
+r and calculate the corresponding y values at each position
as
y = y
c
+(- ) (r
2
– (xc –x )
2
)
1/2
 This is not the best method:
 Considerable amount of computation
 Spacing between plotted pixels is not uniform

Polar co-ordinates for a circle
 We could use polar coordinates r and θ,
x = x
c
+ r cosθ y = y
c
+ r sinθ
 A fixed angular step size can be used to plot equally spaced
points along the circumference
 A step size of 1/r can be used to set pixel positions to
approximately 1 unit apart for a continuous boundary
 But, note that circle sections in adjacent octants within one
quadrant are symmetric with respect to the 45 deg line dividing
the to octants
 Thus we can generate all pixel positions around a circle by
calculating just the points within the sector from x=0 to x=y
 This method is still computationally expensive
Bresenham to Midpoint
 Bresenham requires explicit equation
 Not always convenient (many equations
are implicit)
 Based on implicit equations: Midpoint
Algorithm (circle, ellipse, etc.)
 Implicit equations have the form F(x,y)=0.
Midpoint Circle Algorithm
 We will first calculate pixel positions for a circle centered around
the origin (0,0). Then, each calculated position (x,y) is moved to
its proper screen position by adding xc to x and yc to y

 Note that along the circle section from x=0 to x=y in the first
octant, the slope of the curve varies from 0 to -1

 Circle function around the origin is given by
fcircle(x,y) = x
2
+ y
2
– r
2

 Any point (x,y) on the boundary of the circle satisfies the
equation and circle function is zero

Midpoint Circle Algorithm
 For a point in the interior of the circle, the circle function is negative
and for a point outside the circle, the function is positive
 Thus,
 f
circle
(x,y) < 0 if (x,y) is inside the circle boundary
 f
circle
(x,y) = 0 if (x,y) is on the circle boundary
 f
circle
(x,y) > 0 if (x,y) is outside the circle boundary

yk
Yk-1
xk xk+1 Xk+3 Midpoint
X
2
+y
2
-r
2
=0
Midpoint between candidate
pixels at sampling position
x
k
+1 along a circular path
Midpoint Circle Algorithm
 Assuming we have just plotted the pixel at (x
k
,y
k
) , we next
need to determine whether the pixel at position (x
k
+ 1, y
k
-1) is
closer to the circle
 Our decision parameter is the circle function evaluated at the
midpoint between these two pixels

p
k
= f
circle
(x
k
+1, y
k
-1/2) = (x
k
+1)
2
+ (y
k
-1/2)
2
– r
2

If p
k
< 0 , this midpoint is inside the circle and the pixel on the
scan line y
k
is closer to the circle boundary. Otherwise, the
mid position is outside or on the circle boundary, and we select
the pixel on the scan line y
k
-1

Midpoint Circle Algorithm
 Successive decision parameters are obtained using incremental
calculations
P
k+1
= f
circle
(x
k+1
+1, y
k+1
-1/2)
= [(x
k+1
)+1]
2
+ (y
k+1
-1/2)
2
–r
2

OR
P
k+1
= P
k
+2(x
K
+1) + (y
K+1
2
– y
k
2
) – (y
k
+1- y
k
)+1
Where y
k+1
is either y
k
or y
k-1
, depending on the sign of p
k
 Increments for obtaining P
k+1
:
2x
k+1
+1 if p
k
is negative
2x
k+1
+1-2y
k+1
otherwise
Midpoint circle algorithm
 Note that following can also be done incrementally:
2x
k+1
= 2x
k
+2
2 y
k+1
= 2y
k
– 2
 At the start position (0,r) , these two terms have the values 2
and 2r-2 respectively
 Initial decision parameter is obtained by evaluating the circle
function at the start position (x0,y0) = (0,r)
p
0
= f
circle
(1, r-1/2) = 1+ (r-1/2)
2
-r
2
OR
P
0
= 5/4 -r
 If radius r is specified as an integer, we can round p
0
to
p
0
= 1-r

The actual algorithm
1: Input radius r and circle center (x
c
,y
c
) and obtain the first
point on the circumference of the circle centered on the origin
as
(x
0
,y
0
) = (0,r)
2: Calculate the initial value of the decision parameter as
P
0
= 5/4 - r
3: At each x
k
position starting at k = 0 , perform the
following test:
If p
k
< 0 , the next point along the circle centered on (0,0) is
(x
k+1
, y
k
) and
p
k+1
= p
k
+ 2x
k+1
+ 1

The algorithm
Otherwise the next point along the circle is (x
k+1
, y
k-1
) and
p
k+1
= p
k
+ 2x
k+1
+1 -2y
k+1

Where 2x
k+1
= 2x
k+2
and 2y
k+1
= 2y
k
-2
4: Determine symmetry points in the other seven octants
5: Move each calculated pixel position (x,y) onto the
circular path centered on (x,yc) and plot the coordinate
values
x = x+ x
c
, y= y+ y
c
6: Repeat steps 3 through 5 until x >= y
Midpoint Ellipse
 Derivation
Midpoint Ellipse Algorithm
 Input and ellipse center and obtain the
first point on an ellipse centered on the origin as

 Calculate the initial value of the decision parameter in
region 1 as

2 2 2
0
4
1
1
x y x y
r r r r p + ÷ =
y x
r r , ( )
c c
y x ,
( ) ( )
y
r y x , 0 ,
0 0
=
Midpoint Ellipse..
 At each position in region 1, starting at k =
0, perform the following test. if , the
next point along the ellipse centered on (0,0)
is and

 Otherwise, the next point along the ellipse is
and

with
and continue until
k
x
0 1 <
k
p
( )
k k
y x ,
1 +
2
1
2
1
2 1 1
y k y k k
r x r p p + + =
+ +
( ) 1 , 1 ÷ +
k k
y x
2
1
2
1
2
1
2 2 1 1
y k x k y k k
r y r x r p p + ÷ + =
+ + +
2 2
1
2 2 2
1
2
2 2 2 , 2 2 2
x k x k x y k y k y
r y r y r r x r x r ÷ = + =
+ +
y r x r
x y
2 2
2 2 >
Midpoint Ellipse Contd.
 Calculate the initial value of the decision parameter in
region 2 as

where is the last position calculated in region 1
 At each position in region 2, starting at k=0,
perform the following test. if , the next point
along the ellipse centered on (0,0) is and

 Otherwise, the next point along the ellipse is
and

 Using the same incremental calculations for x and y
as in region 1. Continue until y=0
( )
2 2
2
0
2
2
0
2
0
1
2
1
2
y x x y
r r y r x r p ÷ ÷ +
|
.
|

\
|
+ =
( )
0 0
, y x
k
y
0 2 >
k
p
( ) 1 , ÷
k k
y x
2
1
2
1
2 2 2
x k x k k
r y r p p + ÷ =
+ +
( ) 1 , 1 ÷ +
k k
y x
2
1
2
1
2
1
2 2 2 2
x k x k y k k
r y r x r p p + ÷ + =
+ + +
Midpoint Ellipse
 For both regions, determine symmetry
points in the other three quadrants
 Move each calculated pixel position (x,
y) onto the elliptical path that is
centered on and plot the
coordinate values

( )
c c
y x ,
c c
y y y x x x + = + = ,

6 5 4 3 2 1 0

(3, 3)

0 1 2 3 4 5 6

Line drawing (cont)
The thinnest line is of one-pixel wide. We will concentrate on drawing a line of 1 pixel resolution.  The Cartesian slope-intercept equation for a straight line is y= m. x + b m is the slope of the line and b is the y intercept. Given the endpoints of a line segment. m = y2-y1 / x2-x1 b= y1-m.x1

x Similarly we can obtain the x interval ∆x corresponding to a specified ∆y as ∆x= ∆y / m These equations form the basis for determining deflection voltages in analog devices.Line Drawing (cont)    Also for any given interval ∆x along a line. . we can compute the corresponding y interval ∆y from ∆y= m.

lines are plotted with pixels. we can compute the corresponding y interval ∆y from ∆y= m. On Raster systems. .Line Drawing (cont)    Also . Hence we ought to “sample” a line at discrete positions and determine the nearest pixel to the line at each sampled position. for any given x interval ∆x along a line. and step sizes in the horizontal and vertical directions are constrained by pixel separations. ∆ x These equations form the basis for determining deflection voltages in analog devices.

Symmetry  If we could draw lines with positive slope (0<=slope<=1) we would be done.x) (x.x) (x.-y) (-x.  For a line with negative slope (0>=slope>=-1) We negate all Y values  For a line with slope > 1 or slope <-1 we just swap x and y axes (-y.-x) (y.y) (x.-y) 450 .-x) (y.-y) (-y.

int y) draw_pixel(y. -QY. draw_fn) Else if (-1 <= slope <= 0) draw_fn = invert_y_draw Draw_line(PX.QY.-x) If(0 <= slope <= 1) draw_fn= draw_pixel draw_lne(Px.int y) draw_pixel(y. Invert_y_draw(int x.QX) Else Draw_fn=swap_xy_invert_y_draw Draw_line(-PY. QX. QY.-y) Swap_xy_draw(int x.x) Swap_xy_invert_y_draw(int x.QY. PY.PX.-QX.PX.Code for drawing a line ………. QX.int y) draw_pixel(x. draw_fn) Else if (1 < slope) draw_fn= swap_xy_draw Draw_line(PY. draw_fn) . -PY.

The following is thus the basic incremental scanconversion(DDA) algorithm for line drawing for x from x0 to x1 Compute y=mx+b Draw_fn(x. round(y)) Major deficiency in the above approach :  Uses floats  Has rounding operations   .DDA ALGORITHM  The digital differential analyzer (DDA) samples the line at unit intervals in one coordinate corresponding integer values nearest the line path of the other coordinate.

Round(yj+m)) (xi. Round(yj)) y2 y1 x1 x2 .DDA Illustration Desired Line (xi+1. yj+m) (xi. yj) (xi+1.

yk) is to be displayed.y0) of a given line . Starting from the left end point (x0.  . scan converts lines using only incremental integer calculations that can be adapted to display circles and other curves. Keeping in mind the symmetry property of lines. lets derive a more efficient way of drawing a line. we step to each successive column (x position) and plot the pixel whose scan-line y value closest to the line path Assuming we have determined that the pixel at (xk.Bresenham’s Line Algorithm  An accurate. efficient raster line drawing algorithm developed by Bresenham. we next need to decide which pixel to plot in column xk+1.

.

m(xk + 1) – b  The difference between these 2 separations is d1-d2 = 2m(xk + 1) – 2 yk + 2b – 1  A decision parameter pk for the kth step in the line algorithm can be obtained by rearranging above equation so that it involves only integer calculations . yK+1) d1 = y – yk = m(xk + 1) + b – yk d2 = (yk + 1) – y = yk + 1.Bresenham Line Algorithm (cont) Choices are(xk +1. yk) and (xk+1.

e. Otherwise . Parameter c is a constant and has the value 2Δy + Δx(2b-1) (independent of pixel position) If pixel at yk is closer to line-path than pixel at yk +1 (i. since Δx > 0. We plot lower pixel in such a case.Bresenham’s Line Algorithm  Define Pk = Δx ( d1-d2) = 2Δyxk-2 Δxyk + c  The sign of Pk is the same as the sign of d1-d2. upper pixel will be plotted.  . if d1 < d2) then pk is negative.

Bresenham’s algorithm (cont)  At step k + 1.xk)-2Δx(yk+1 – yk)  But. xk+1 = xk +1.2Δxyk+1 + c  Taking the difference of pk+ 1 and pk we get the following. pk+1 – pk = 2Δy(xk+1.2 Δx(yk+1 – yk)  Where the term yk+1-yk is either 0 or 1. so that pk+1 = pk + 2Δy . pk+1 = 2Δyxk+1 . the decision parameter can be evaluated as. depending on the sign of parameter pk .

y0) satisfies the line equation .Bresenham’s Line Algorithm  The first parameter p0 is directly computed p0 = 2 Δyxk .2 Δxyk + c = 2 Δyxk – 2 Δy + Δx (2b-1)  Since (x0. we will have time to be scan converted p0 = 2Δy – Δx The constants 2Δy and 2Δy-2Δx are calculated once for each . we also have y0 = Δy/ Δx * x0 + b  Combining the above 2 equations .

y0) Load (x0.Bresenham’s Line Algorithm  So.y0) into the frame buffer (plot the first point) Calculate the constants Δx. 2Δy and 2Δy-2Δx and obtain the starting value for the decision parameter as p0 = 2Δy. Δy.Δx . the arithmetic involves only integer addition and subtraction of 2 constants Input the two end points and store the left end point in (x0.

starting at k=0. the next point is (xk+1. yk+1) pk+1 = pk + 2Δy .2Δx Repeat step 4 (above step) Δx times . perform the following test: If pk < 0 . yk) and pk+1 = pk + 2Δy Otherwise Point to plot is (xk+1.Bresenham’s Line Algorithm At each xk along the line.

Where do we draw a circle???  Properties of a circle: A circle is defined as a set of points that are all the given distance (xc.yc).) (r2 – (xc –x )2)1/2  Considerable amount of computation Spacing between plotted pixels is not uniform . This distance relationship is expressed by the pythagorean theorem in Cartesian coordinates as  We could use this equation to calculate the points on the circle circumference by stepping along x-axis in unit steps from xc-r to xc+r and calculate the corresponding y values at each position as This is not the best method:   (x – xc)2 + (y – yc) 2 = r2 y = yc +(.

Polar co-ordinates for a circle  We could use polar coordinates r and θ. x = xc + r cosθ  y = yc + r sinθ     A fixed angular step size can be used to plot equally spaced points along the circumference A step size of 1/r can be used to set pixel positions to approximately 1 unit apart for a continuous boundary But. note that circle sections in adjacent octants within one quadrant are symmetric with respect to the 45 deg line dividing the to octants Thus we can generate all pixel positions around a circle by calculating just the points within the sector from x=0 to x=y This method is still computationally expensive .

.

.

.y)=0. ellipse.) Implicit equations have the form F(x. etc.Bresenham to Midpoint  Bresenham requires explicit equation    Not always convenient (many equations are implicit) Based on implicit equations: Midpoint Algorithm (circle.

each calculated position (x. the slope of the curve varies from 0 to -1 Circle function around the origin is given by fcircle(x.y) on the boundary of the circle satisfies the equation and circle function is zero .y) is moved to its proper screen position by adding xc to x and yc to y Note that along the circle section from x=0 to x=y in the first octant.0).y) = x2 + y2 – r2    Any point (x. Then.Midpoint Circle Algorithm  We will first calculate pixel positions for a circle centered around the origin (0.

.

y) is on the circle boundary  fcircle(x.y) is inside the circle boundary  fcircle(x. the function is positive Thus.y) = 0 if (x.y) < 0 if (x.  fcircle(x. the circle function is negative and for a point outside the circle.Midpoint Circle Algorithm   For a point in the interior of the circle.y) is outside the circle boundary yk Yk-1 X2+y2-r2=0 Midpoint xk xk+1 Xk+3 Midpoint between candidate pixels at sampling position xk+1 along a circular path .y) > 0 if (x.

we next need to determine whether the pixel at position (xk + 1. the mid position is outside or on the circle boundary. Otherwise. yk-1/2) = (xk +1)2 + (yk -1/2)2 – r2 If pk < 0 . and we select the pixel on the scan line yk-1 .Midpoint Circle Algorithm   Assuming we have just plotted the pixel at (xk. yk-1) is closer to the circle Our decision parameter is the circle function evaluated at the midpoint between these two pixels pk = fcircle (xk +1. this midpoint is inside the circle and the pixel on the scan line yk is closer to the circle boundary.yk) .

yk+1-1/2) = [(xk+1)+1]2 + (yk+1 -1/2)2 –r2 OR Pk+1 = Pk+2(xK+1) + (yK+12 – yk2) – (yk+1.Midpoint Circle Algorithm  Successive decision parameters are obtained using incremental calculations Pk+1 = fcircle(xk+1+1. depending on the sign of pk  Increments for obtaining Pk+1: 2xk+1+1 if pk is negative 2xk+1+1-2yk+1 otherwise .yk)+1 Where yk+1 is either yk or yk-1.

these two terms have the values 2 and 2r-2 respectively Initial decision parameter is obtained by evaluating the circle function at the start position (x0.Midpoint circle algorithm  Note that following can also be done incrementally:   At the start position (0. we can round p0 to p0 = 1-r . r-1/2) = 1+ (r-1/2)2-r2 OR P0 = 5/4 -r  If radius r is specified as an integer.r) 2xk+1 = 2xk +2 2 yk+1 = 2yk – 2 p0 = fcircle(1.y0) = (0.r) .

y0) = (0.yc) and obtain the first point on the circumference of the circle centered on the origin as (x0. yk) and pk+1 = pk + 2xk+1 + 1 .0) is (xk+1.r) 2: Calculate the initial value of the decision parameter as P0 = 5/4 .r 3: At each xk position starting at k = 0 . perform the following test: If pk < 0 .The actual algorithm 1: Input radius r and circle center (xc. the next point along the circle centered on (0.

yc) and plot the coordinate values x = x+ xc . yk-1) and pk+1 = pk + 2xk+1 +1 -2yk+1 Where 2xk+1 = 2xk+2 and 2yk+1 = 2yk-2 4: Determine symmetry points in the other seven octants 5: Move each calculated pixel position (x. y= y+ yc 6: Repeat steps 3 through 5 until x >= y .The algorithm Otherwise the next point along the circle is (xk+1.y) onto the circular path centered on (x.

Midpoint Ellipse  Derivation .

.

.

.

y0   0.Midpoint Ellipse Algorithm  Input rx . ry and ellipse center  xc . yc  and obtain the first point on an ellipse centered on the origin as x0 . ry   Calculate the initial value of the decision parameter in region 1 as 1 2 p10  r  r r  rx 4 2 y 2 x y .

. yk  1 and p1k 1  p1k  2ry2 xk 1  2rx2 yk 1  ry2 2rx2 yk 1  2rx2 yk  2rx2 with 2ry2 xk 1  2ry2 xk  2ry2 . starting at k = 0. the next point along the ellipse centered on (0.Midpoint Ellipse. if p1k  0 . perform the following test. yk  and p1k 1  p1k  2ry2 xk 1  ry2  Otherwise.0) is xk 1 . the next point along the ellipse is xk  1. and continue until 2ry2 x  2rx2 y .  At each x k position in region 1.

starting at k=0.0) is xk . y0  is the last position calculated in region 1 At each y k position in region 2. the next point along the ellipse is and xk  1.  Calculate the initial value of the decision parameter in 2 region 2 as 1  2 p20  ry2  x0    rx2  y0  1  rx2 ry2 where  x0 . if p 2k  0 . yk  1 and Otherwise. perform the following test. Continue until y=0 p 2 k 1  p 2 k  2rx2 yk 1  rx2  2    .Midpoint Ellipse Contd. the next point along the ellipse centered on (0. yk  1 p2k 1  p2k  2ry2 xk 1  2rx2 yk 1  rx2 Using the same incremental calculations for x and y as in region 1.

yc  and plot the coordinate values x  x  xc . y) onto the elliptical path that is centered on xc .Midpoint Ellipse   For both regions. y  y  yc . determine symmetry points in the other three quadrants Move each calculated pixel position (x.

..9: 7797333/736. 736.: ".572 :5..369735:0.1 . 0..2    1 1 .7...573.

72  .9.10:657.5/.9:5.90.4:.:.4. ..4 065.: 72 2 .3.369.1.

63365 72   72  2 . 2  0 '..1950672  .5172 .25.

2 .

2  2  :6.. 72  72 . 2   2 ..

 2   2 9..942 .

2 :.969 1751565.972 .4.:5 67.9.

9:5.30647.4:5369.4 '9:.4.7.9.97 :190.1 7 2 .

2 02    /.

 &50   :.51.    / 64/55..3:6.65: 33..65 . 7  '065:.: .358./68..5.::...

1 .90.50659..303.165069. .4.6/:0.0 .

65.5.303.:  .4.69.9. 765.4 &6 .9.9:.0563:6535.065:...4:5369.5.4/9 736.3.. .9:5..51 765.65 6065:.0.6.5   6..: 57.:.1   5..11.51..9.51:..651765.9.51:/.

5.516/..9.9.369..9.: 7 .5.10:65 7.:. .4.

 .

5.02 .: 2  2   72  72 .9: #65.4:5369.5.6736.365.2 79694...4 .:.. 72  .35 :.765.: 2  2 . 63365.9:5..9.51 72  72  ".

.4: .  %7.7 .7 .:./6:.

5066915.:65...:..775.765. 7.91619.365.303.69....0903 0903:151....:8.6945..6765.:  0    0  9 0631:.:.:.33.65:7:79::1/.9.50 0 0 ':1:.9.:6.60.65.5..5 1:.:.0903 #9679.:.5093.0903 0904950/:..

.7:964 0.:55.:.

076:.65 .303.6 0 9 ..510..3:.9 .: 0 ..0699:76515..

/:./3.65 &7.4...465.  9  0   '::56.173::56.5736.05/..5694 .61 65:19..60647.

#63.906.

35..559.7:690.5...0904950 :.69.60.6 ':4.303.0903 0631:763.9066915.69964.660.065.135115 .9 .565 8.7:0.5/:1.5:..0903/ 0.. 56.9651.01 765.5..9..19.7.:69.05..3375: ..6915.:0.:.7376:.:.5.56:/651..65:5..9:44.1..65:.6:.5.6 .330647.9:.:.33:7..: ':0.8.77964.9:70.65:...5/:1.65.61::.6.365..0903:0.337376:.90..6736.53.51Û 0 906:Û 0 9:5Û 1.:9..765.

.

.

 369.:1654730..8.65:.94730. .8.4 0903 337: .65: 1765. 4.65 !6..65: .4..4989:730..:06555.8.58.9:5..694    .3.0 4730.6 1765.. 9:5.

9:964.7376:.903369.91...:3676.0903:0.65:69.303.510.65/.09.0.65.365. .1150..090305.00.65964.:79679:09576:..176:.1765.65   :461.6...695   '5 .9:.6 !6.4 339:. 60.6.9651 .6 .5.303..

 8.   65.65.65:96 .65.9651..695:5/ 0903      9 5765..51090350./651. 90350.::.0903:.96.

.

1765.9 2 2.0903 .50.0903 .5..765. ': 0903      :5:1.5.5169.0903/651.9 0903      :6.6.9696.:1.:1.090350.65:5.9 0903      :65.0903/651.65:76:.4 69.903369. .0903/651.765.

  .

2 2  2  .97.365...50.511. 1765..9 1765. 73:.:./.65 2 .473576:.0903.

1765.945..4 ::45.:.76:.736.65 2  2.9.903369..61..73. 2 2 5.1. 51.73.

/.1.:.673: 72 0903 2  2.3.090350..0903 "910:657.9..6.5.. : 036:9.9:. 41765.65.4.

  2    2 .

0903. :0.9 .0903/651.65:6.:16965. .:41765.7365.   9 72  .:5:1.:0. 4176:.51.5352 :036:9.7365.9 ".9: .6.51:30.0903/651.5352.

 .

.4 &00::10:657.1765.4..9.65: #2  0903 2   2 .9:.51:550945.303.96/.3 0..903369.

 ( 2  *  2  .

  9 "% #2  #2         2  2 .

92 692. 2  92  :.

:696/.55#2  2  72 :5. 1751565.:5672 50945... 2  .

9: .2  6.

.:.369...4 !6.1765.6.633650.9..76:.3:6/16550945.33 2  2  2  2  .94:..519..3: ..:.0903.5..65  9 .

3.9:6/...310:657.5.65.9..51/.3 5.9:70.0903 50.4.65     9 70903  9...:..9.76:.

   9.

 .

9 "% # .

596517 .6 7 .1:9::701.9 9.:.9 0.55.

9 .

'.3..303.36.695 .369. 765.5.090305.516/.: # .9.65..09049506.5.0..4.3.9.:     9 .9:.51090305..4 57.1:9..10:657.9 0 0 .9165.9.

9.5. 9 .2 79694.5.51 72  72 2   . 72  . 63365...02 76:.765.65:.9165   : 2  2 .:.090305...365.

369.765.9:.4 "..5.0903: 2  2.'.365.

51 72  72 2  . .

512  2.2  92  2  .

:  6.965.3:  0  0 %7. .51736.945:44.5.00.65   65.97.. 0903.9:560.:.17376:.6.066915..3 .05. ..9765.7:.:5....9165  0 .6.303.

1765.337: 9.65 ..

.

.

.

765.4 7 7 .3.1765.. 57.9.10:657.9..9165.95 965. 9:.: 5  7 7 7        7  .65.516/.5337:05.5....303.5.695.51337:05. .337:369.:    7 .4.36.

2 5   79694.076:.5.  .3 7  K 7  .365...51065.9165       :..55.1765.51 5   5 7   7 ".:.5.9.51 5   5 7   7   7 7    7  7 . 7    7  7 .337:  .337::     .765.655965 :.765...63365.9: . 5.365.337:05.

9: .303.765.650.337:05.15965  .337:: .10:657.076:.5.1765.365.9.76:.5.1 .  .51 .30.3.:..5..51     5     5   7   7 "..303.365.51     5     5   7   7   7 :5....450945.9165   :..36. .55.9.65:69..765.:5965 65.63365.3.4..337:65.95  965.:       5   7   7   7 7   9:.3 .655965 :.5..303.:.2  5  79694.:.

337: 69/6.98.337. ..:5.965: 1..19.. 066915..5. 05..65    65..0.17376:...9 765.9165. .6.9.1765.303.37.: .51736.  .945:44.6.00.: 6.3:    .