SlideShare une entreprise Scribd logo
1  sur  22
Scan Converting an Ellipses
The ellipse is also a symmetric figure like a
circle, but it has four- way symmetry rather than
eight-way. There are two methods:
(1) Polynomial Method of defining an
   Ellipses
   It is given by the equation:
          (x - h)2 + (y - k)2 = 1
            a2          b2
where (h, k) = ellipse center
          a = length of major axis
          b = length of minor axis
                 y
                                   Center(h, k)
                       b       a
                 k

                           h               x
When the polynomial method is used to
define an ellipse, the value of x is
    incremented
from h to a. For each step of x, each value of
    y
is found by evaluating the expression.
           y = b 1 – (x – h)2 + k
                         a2
This method is very inefficient, because the
square of a and (x – h) must be found; then
floating-point division of (x-h)2 by a2 etcs….
(2) Trigonometric method of defining an
     Ellipses:
The following equations define an ellipse
trignometrically :
    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
The value of θ is varied from 0 to π/2 radians.
The remaining points are found by symmetry.
                 y            (acos(θ)+h, bsin(θ)+k)

                      b           a
                 k            θ


                                                x
                          h
Ellipse Axis Rotation
Since the ellipse shows four-way symmetry, it
can easily be rotated 90°. The new equation is
found by trading a & b, the values which
describe the major & minor axes. The
equation is:
        (x - h)2 + (y - k)2 = 1
           b2          a2
         a = length of major axis
         b = length of minor axis
In trigonometric method the equations are:
 x = b cos(θ) + h    and y = a sin(θ) + k
Where (x, y) = the current coordinates
           a = length of major axis
           b = length of minor axis
            θ = current angle
Assume that the ellipse is rotate through an
angle of 90º. This rotation can be
accomplished by rotating the x & y axis
α degrees.
Midpoint Ellipse Algorithm
This is an incremental method for scan
converting an ellipse that is centered at origin
in standard position i.e with its major & minor
axes parallel to coordinate system axis.
It is very similar to midpoint circle algorithm.
However, b’coz 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 function f that can be used to decide if
the midpoint between two candidate pixel is
inside or outside the ellipse:
                                 < 0 (x,y) inside
  f(x,y) = b2x2 + a2y2 – a2b2 = 0 (x,y) on
                                 > 0 (x,y) outside
xi   xi+1
                T
    yi
b                                      Slope = -1
               S     Part 1
                                        Q


                              Part 2
                                            yj

                                         yj-1 U         V
                                              xj
                                                    a
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.
Slope of the curve is defined by f(x,y) = 0 is
dy/dx = - fx/fy, where fx & fy are partial
derivatives of f(x,y) with respect to x & y.
We have fx = 2b2x, fy = 2a2y &
dy/dx = - 2b2x/ 2a2y. Hence we can monitor
the slope value during the scan-conversion
process to detect Q.
Out 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 i +1,yi) or
S(x i +1, yi – 1) to be the next pixel. The
midpoint of T & S is used to define the
following decision parameter.
 pi = f (x i +1, yi – ½)
pi = b2(x i +1)2 + a2(yi – ½)2 – a2b2
If pi < 0, the midpoint is inside the curve, &
    we choose pixel T.
If pi > 0, the midpoint is outside or on the
    curve, & we choose pixel S.
Decision parameter for the next step is:
pi +1 = f (x i +1 + 1, yi +1 – ½)
       = b2(x i +1 + 1)2 + a2(yi +1 – ½)2 – a2b2
Since x i +1 = xi + 1, we have
pi +1- pi = b2[(xi +1 + 1)2 - xi +12]
               + a2[(yi +1 – ½)2 – (yi – ½)2]
     pi +1 = pi +2b2xi +1 + b2 + a2[(yi +1 – ½)2 –
          (yi – ½)2]
 If T is chosen pixel (meaning pi < 0), we
 have yi +1 = yi
If S is chosen pixel (meaning pi > 0), we
 have yi +1 = yi – 1. Thus we can express
   pi +1 in terms of pi and (xi +1, yi +1 ):
pi +1 = pi + 2b2xi+1 + b2             if pi < 0
        pi + 2b2xi+1 + b2 – 2a2yi+1   if pi > 0
The initial value for this recursive expression
  can be obtained by evaluating the original
  definition of pi with (0,b):
p1 = b2 + a2(b – ½)2 – a2b2
   = b2 – a2b + a2/4
We now move on to derive a similar formula
  for part 2 of the curve
Suppose pixel (xj, yj) has just been scan
converted upon entering step j. The next pixel
is either U(xj, yj-1) or V(x j +1, yj – 1). The
midpoint of the horizontal line connecting U
& V is used to define the decision parameter.
 qj = f (x j + ½, yj – 1)
 qj = b2(x j + ½)2 + a2(yj – 1)2 – a2b2
If qj < 0, the midpoint is inside the curve, &
 we choose pixel V.
If qj > 0, the midpoint is outside or on the
     curve, & we choose pixel U. Decision
     parameter for the next step is:
 qj +1 = f (x j +1 + ½, yj +1 – 1)
        = b2(x j +1 + ½)2 + a2(yj +1 – 1)2 – a2b2
Since yj +1 = yj - 1, we have
qj +1- qj = b2[(xj +1 + ½)2 – (xj +½)2] +
                a2[(yj +1 – 1)2 – (yj+1)2]
       qj +1 = qj + b2 [(xj +1 + ½)2 – (xj +½)2]
                - 2a2yj+1 + a2
 If V is chosen pixel (meaning qj < 0), we
 have xj +1 = xj + 1
If U is chosen pixel (meaning pi > 0), we
 have xj +1 = xj. Thus we can express
   qj +1 in terms of qj and (xj +1, yj +1 ):
qj +1 = qj + 2b2xj+1-2a2yj+1 + a2     if qj < 0
        qj - 2a2yj+1 + a2                 if qj > 0
The initial value for this recursive expression
is computed using the original definition of qj
And the coordinates (xk, yk) of the last pixel
  chosen for part 1 of the curve:
q1 = f (xk + ½, yk – 1)
   = b2(xk + ½)2 – a2(yk – 1)2 - a2b2


Algorithm:
int x=0, y=b; (starting point)
int fx =0, fy = 2a2b (Initial partial derivative)
int p = b2 – a2b + a2/4
while (fx < fy) /* |slope| < 1 */
 { setPixel(x,y)
   x++;
   fx = fx + 2b2;
if (p < 0)
       p = p + fx + b2;
else {
      y--;
      fy = fy – 2a2;
p= p + fx + b2 – fy;
  }
 }
setPixel(x,y);      /* set pixel at (x k,yk) */
p = b2(x+0.5)2 + a2(y-1)2 - a2 b2;
while (y > 0) {
y--;
fy = fy – 2a2;
if (p >= 0)
p = p – fy + a2;
    else {
        x++;
        fx = fx + 2b2;
        p = p + fx – fy +a2;
     }
      setPixel(x,y);
}

Contenu connexe

Tendances

Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan systemshalinikarunakaran1
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cppAlamgir Hossain
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformationSelvakumar Gna
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse2013901097
 
Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2Iftikhar Ahmad
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
3D Transformation
3D Transformation3D Transformation
3D TransformationSwatiHans10
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphicsKALESHWAR KUMAR
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)shalinikarunakaran1
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformationUdayan Gupta
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiionMuhammadHamza401
 
Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewingMohd Arif
 

Tendances (20)

Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
 
Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
3D Transformation
3D Transformation3D Transformation
3D Transformation
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiion
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewing
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
 

Similaire à Ellipses drawing algo.

Similaire à Ellipses drawing algo. (20)

Alg2 lesson 6-6
Alg2 lesson 6-6Alg2 lesson 6-6
Alg2 lesson 6-6
 
6.6 analyzing graphs of quadratic functions
6.6 analyzing graphs of quadratic functions6.6 analyzing graphs of quadratic functions
6.6 analyzing graphs of quadratic functions
 
Quadratic equation.pptx
Quadratic equation.pptxQuadratic equation.pptx
Quadratic equation.pptx
 
Equation of second degree
Equation of second degreeEquation of second degree
Equation of second degree
 
Equation of second degree
Equation of second degreeEquation of second degree
Equation of second degree
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
 
Angle and Slope, Isometri
Angle and Slope, IsometriAngle and Slope, Isometri
Angle and Slope, Isometri
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
(5) Ellipse (Theory). Module-3pdf
(5) Ellipse (Theory). Module-3pdf(5) Ellipse (Theory). Module-3pdf
(5) Ellipse (Theory). Module-3pdf
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Elliptical curve cryptography
Elliptical curve cryptographyElliptical curve cryptography
Elliptical curve cryptography
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
U unit4 vm
U unit4 vmU unit4 vm
U unit4 vm
 
Conformal mapping
Conformal mappingConformal mapping
Conformal mapping
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
48 circle part 1 of 2
48 circle part 1 of 248 circle part 1 of 2
48 circle part 1 of 2
 
Integration
IntegrationIntegration
Integration
 
Plano numerico
Plano numericoPlano numerico
Plano numerico
 
Quadraticfunctionpresentation 100127142417-phpapp02
Quadraticfunctionpresentation 100127142417-phpapp02Quadraticfunctionpresentation 100127142417-phpapp02
Quadraticfunctionpresentation 100127142417-phpapp02
 

Plus de Mohd Arif

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcpMohd Arif
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarpMohd Arif
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocolMohd Arif
 
Project identification
Project identificationProject identification
Project identificationMohd Arif
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniquesMohd Arif
 
Presentation
PresentationPresentation
PresentationMohd Arif
 
Pointers in c
Pointers in cPointers in c
Pointers in cMohd Arif
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peerMohd Arif
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systemsMohd Arif
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdpMohd Arif
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgetingMohd Arif
 
Network management
Network managementNetwork management
Network managementMohd Arif
 
Networing basics
Networing basicsNetworing basics
Networing basicsMohd Arif
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformMohd Arif
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and sslMohd Arif
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psecMohd Arif
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardwareMohd Arif
 

Plus de Mohd Arif (20)

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcp
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
Project identification
Project identificationProject identification
Project identification
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniques
 
Presentation
PresentationPresentation
Presentation
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peer
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systems
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgeting
 
Network management
Network managementNetwork management
Network management
 
Networing basics
Networing basicsNetworing basics
Networing basics
 
Loaders
LoadersLoaders
Loaders
 
Lists
ListsLists
Lists
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platform
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psec
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardware
 
Heap sort
Heap sortHeap sort
Heap sort
 

Ellipses drawing algo.

  • 1. Scan Converting an Ellipses The ellipse is also a symmetric figure like a circle, but it has four- way symmetry rather than eight-way. There are two methods: (1) Polynomial Method of defining an Ellipses It is given by the equation: (x - h)2 + (y - k)2 = 1 a2 b2
  • 2. where (h, k) = ellipse center a = length of major axis b = length of minor axis y Center(h, k) b a k h x
  • 3. When the polynomial method is used to define an ellipse, the value of x is incremented from h to a. For each step of x, each value of y is found by evaluating the expression. y = b 1 – (x – h)2 + k a2 This method is very inefficient, because the square of a and (x – h) must be found; then floating-point division of (x-h)2 by a2 etcs….
  • 4. (2) Trigonometric method of defining an Ellipses: The following equations define an ellipse trignometrically : 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
  • 5. The value of θ is varied from 0 to π/2 radians. The remaining points are found by symmetry. y (acos(θ)+h, bsin(θ)+k) b a k θ x h
  • 6. Ellipse Axis Rotation Since the ellipse shows four-way symmetry, it can easily be rotated 90°. The new equation is found by trading a & b, the values which describe the major & minor axes. The equation is: (x - h)2 + (y - k)2 = 1 b2 a2 a = length of major axis b = length of minor axis
  • 7. In trigonometric method the equations are: x = b cos(θ) + h and y = a sin(θ) + k Where (x, y) = the current coordinates a = length of major axis b = length of minor axis θ = current angle Assume that the ellipse is rotate through an angle of 90º. This rotation can be accomplished by rotating the x & y axis α degrees.
  • 8. Midpoint Ellipse Algorithm This is an incremental method for scan converting an ellipse that is centered at origin in standard position i.e with its major & minor axes parallel to coordinate system axis. It is very similar to midpoint circle algorithm. However, b’coz of the four-way symmetry property we need to consider the entire elliptical curve in the first quadrant.
  • 9. Let’s first rewrite the ellipse equation and define function f that can be used to decide if the midpoint between two candidate pixel is inside or outside the ellipse: < 0 (x,y) inside f(x,y) = b2x2 + a2y2 – a2b2 = 0 (x,y) on > 0 (x,y) outside
  • 10. xi xi+1 T yi b Slope = -1 S Part 1 Q Part 2 yj yj-1 U V xj a
  • 11. 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. Slope of the curve is defined by f(x,y) = 0 is dy/dx = - fx/fy, where fx & fy are partial derivatives of f(x,y) with respect to x & y. We have fx = 2b2x, fy = 2a2y & dy/dx = - 2b2x/ 2a2y. Hence we can monitor the slope value during the scan-conversion process to detect Q.
  • 12. Out 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 i +1,yi) or S(x i +1, yi – 1) to be the next pixel. The midpoint of T & S is used to define the following decision parameter. pi = f (x i +1, yi – ½)
  • 13. pi = b2(x i +1)2 + a2(yi – ½)2 – a2b2 If pi < 0, the midpoint is inside the curve, & we choose pixel T. If pi > 0, the midpoint is outside or on the curve, & we choose pixel S. Decision parameter for the next step is: pi +1 = f (x i +1 + 1, yi +1 – ½) = b2(x i +1 + 1)2 + a2(yi +1 – ½)2 – a2b2 Since x i +1 = xi + 1, we have
  • 14. pi +1- pi = b2[(xi +1 + 1)2 - xi +12] + a2[(yi +1 – ½)2 – (yi – ½)2] pi +1 = pi +2b2xi +1 + b2 + a2[(yi +1 – ½)2 – (yi – ½)2]  If T is chosen pixel (meaning pi < 0), we have yi +1 = yi If S is chosen pixel (meaning pi > 0), we have yi +1 = yi – 1. Thus we can express pi +1 in terms of pi and (xi +1, yi +1 ):
  • 15. pi +1 = pi + 2b2xi+1 + b2 if pi < 0 pi + 2b2xi+1 + b2 – 2a2yi+1 if pi > 0 The initial value for this recursive expression can be obtained by evaluating the original definition of pi with (0,b): p1 = b2 + a2(b – ½)2 – a2b2 = b2 – a2b + a2/4 We now move on to derive a similar formula for part 2 of the curve
  • 16. Suppose pixel (xj, yj) has just been scan converted upon entering step j. The next pixel is either U(xj, yj-1) or V(x j +1, yj – 1). The midpoint of the horizontal line connecting U & V is used to define the decision parameter. qj = f (x j + ½, yj – 1) qj = b2(x j + ½)2 + a2(yj – 1)2 – a2b2 If qj < 0, the midpoint is inside the curve, & we choose pixel V.
  • 17. If qj > 0, the midpoint is outside or on the curve, & we choose pixel U. Decision parameter for the next step is: qj +1 = f (x j +1 + ½, yj +1 – 1) = b2(x j +1 + ½)2 + a2(yj +1 – 1)2 – a2b2 Since yj +1 = yj - 1, we have qj +1- qj = b2[(xj +1 + ½)2 – (xj +½)2] + a2[(yj +1 – 1)2 – (yj+1)2] qj +1 = qj + b2 [(xj +1 + ½)2 – (xj +½)2] - 2a2yj+1 + a2
  • 18.  If V is chosen pixel (meaning qj < 0), we have xj +1 = xj + 1 If U is chosen pixel (meaning pi > 0), we have xj +1 = xj. Thus we can express qj +1 in terms of qj and (xj +1, yj +1 ): qj +1 = qj + 2b2xj+1-2a2yj+1 + a2 if qj < 0 qj - 2a2yj+1 + a2 if qj > 0 The initial value for this recursive expression is computed using the original definition of qj
  • 19. And the coordinates (xk, yk) of the last pixel chosen for part 1 of the curve: q1 = f (xk + ½, yk – 1) = b2(xk + ½)2 – a2(yk – 1)2 - a2b2 Algorithm: int x=0, y=b; (starting point) int fx =0, fy = 2a2b (Initial partial derivative) int p = b2 – a2b + a2/4
  • 20. while (fx < fy) /* |slope| < 1 */ { setPixel(x,y) x++; fx = fx + 2b2; if (p < 0) p = p + fx + b2; else { y--; fy = fy – 2a2;
  • 21. p= p + fx + b2 – fy; } } setPixel(x,y); /* set pixel at (x k,yk) */ p = b2(x+0.5)2 + a2(y-1)2 - a2 b2; while (y > 0) { y--; fy = fy – 2a2; if (p >= 0)
  • 22. p = p – fy + a2; else { x++; fx = fx + 2b2; p = p + fx – fy +a2; } setPixel(x,y); }