SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
CS 603 Computer Graphics
Sudipta Mondal
Lecture outline

n   Ellipse-generating algorithm
    n   Properties of ellipse
    n   Midpoint ellipse algorithm




                                     2
Ellipse Generating Algorithm
n   Ellipse – an elongated circle.
n   A modified circle whose radius varies from a
    maximum value in one direction to a minimum value
    in the perpendicular direction.
n   A precise definition in terms of
    distance from any point on the
                                            d1
    ellipse to two fixed position,     F1             P=(x,y)
                                                 d2
    called the foci of the ellipse.         F2


n   The sum of these two distances
    is the same value for all points
    on the ellipse.                                             3
Ellipse Generating Algorithm
n   If the distance of the two focus positions from any
    point P=(x, y) on the ellipse are labeled d1 and d2,
    the general equation of an ellipse:
                              d1 + d2 = constant

n   Expressing distance d1 and d2 in terms of the focal
    coordinates F1=(x1, y1) and F2=(x2, y2), we have

           (x - x1 )2 + ( y - y1 )2 + (x - x2 )2 + ( y - y2 )2 = constant


                                                                            4
Ellipse Generating Algorithm
However, we will only consider ‘standard’ ellipse:


                                        2            2
             ry
                             æ x - xc   ö æ y - yc   ö
yc
                             ç
                             ç r        ÷ +ç
                                        ÷ ç r
                                                     ÷ =1
                       rx
                                                     ÷
                             è x        ø è y        ø
                  xc




                                                         5
Symmetry
n   An ellipse only has a 4-
    way symmetry.

                                                    (x,y)
                               (-x,y)     ry


                                               rx

                                                    (x,-y)
                                (-x,-y)




                                                             6
Equation of an ellipse
n   Consider an ellipse centered at the origin,
    (xc,yc)=(0,0):       2    2
                       æxö æyö
                       ç ÷ + ç ÷ =1
                       çr ÷ çr ÷
                       è xø è yø


                       f e ( x, y ) = ry x + rx y - rx ry
                                    2        2        2     2
Ellipse function                        2        2



…and its properties:
 fellipse(x,y) < 0 if (x,y) is inside the ellipse
 fellipse(x,y) = 0 if (x,y) is on the ellipse
 fellipse(x,y) > 0 if (x,y) is outside the ellipse

                                                                7
Midpoint Ellipse Algorithm
n   Ellipse is different from circle.
n   Similar approach with circle,
    different in sampling direction.              Slope =
                                                  -1
n   Region 1:                           ry
     n Sampling is at x direction
     n Choose between (xk+1, yk), or         rx
        (xk+1, yk-1)                              Region 1

     n Move out if 2r2yx >= 2r2xy                  Region 2

n   Region 2:
     n Sampling is at y direction
     n Choose between (xk, yk-1), or
        (xk+1, yk-1)                                  8
Decision parameters
Region 1:                        Region 2:

p1k = f e ( xk + 1, yk - 1 2 )     p2k = fe ( xk + 12 , yk -1)

p1k < 0:                         p2k <= 0:
n midpoint is inside             • midpoint is inside/on
n choose pixel (xk+1, yk)        • choose pixel (xk+1, yk-1)

p1k >= 0:                        p2k > 0:
n midpoint is outside/on         • midpoint is outside
n choose pixel (xk+1, yk-1)      • choose pixel (xk, yk-1)
                                                             9
Midpoint Ellipse Algorithm
1.   Input rx, ry and ellipse center (xc, yc). Obtain the first point on an
     ellipse centered on the origin (x0, y0) = (0, ry).

2.   Calculate initial value for decision parameter in region 1 as:
                                      2        2                2
                           p1 0 = r y - rx r y +       1
                                                       4   rx

3.   At each xk in region 1, starting from k = 0, test p1k :
                                                                              2             2
        If p1k < 0, next point (xk+1, yk) and              p1k +1 = p1k + 2 ry xk +1 + ry

                                                                       2          2             2
        else, next point (xk+1, yk-1) and p1k +1 = p1k + 2 ry xk +1 - 2 rx y k +1 + ry

     with 2ry2xk+1 = 2ry2xk + 2ry2,       2rx2yk+1 = 2rx2yk – 2rx2

     and repeat step 1 to 3 until 2ry2x ³ 2rx2y                                        10
Midpoint Ellipse Algorithm
4.   Initial value for decision parameter in region 2:

               p 2 0 = ry
                            2
                                (x 0 + 1 )2 + rx 2 ( y 0 - 1 )2 - rx 2 r y 2
                                       2


       where (x0, y0) is the last position calculate in region 1

5. At each yk in region 2, starting from k = 0, test p2k:

                                                                          2              2
      If p2k > 0, next point is (xk, yk-1) and      p 2 k +1 = p 2 k - 2rx y k +1 + rx
                                                                      2             2             2
      else, next point is (xk+1, yk-1) and p 2 k +1 = p 2 k + 2ry xk +1 - 2rx yk +1 + rx

      continue until y=0

                                                                                             11
Midpoint Ellipse Algorithm
6.   For both region determine symmetry points in the other 3
     quadrants

7.   Move each calculated pixel position (x,y) onto the elliptical path
     centered on (xc,yc) and plot the coordinate values
               x=x + xc,        y =y + yc




                                                                  12
Try this out!
Given input ellipse         k   p1k    (xk+1,yk+1)   2ry2 xk+1   2 rx2yk+1
parameter rx=8 and ry=6,    0   -332     (1,6)          72         768
determine pixel positions   1
along the ellipse path in   2
the first quadrant using    3
the midpoint ellipse        4
algorithm                   5
                            6
     2ry2x = ?
                            k   p2k    (xk+1,yk+1)   2rv2 xk+1   2 rx2yk+1
     2rx2y = 2rx2ry = ?
                            0
     p10 = ?
                            1
                            2
                                                                       13
Plot pixel positions


       6
       5
       4
       3
       2
       1
       0
           0   1   2   3   4   5   6   7   8



                                               14

Contenu connexe

Tendances

009 solid geometry
009 solid geometry009 solid geometry
009 solid geometryphysics101
 
Actividad 4 calculo diferencial
Actividad 4 calculo diferencialActividad 4 calculo diferencial
Actividad 4 calculo diferencialSIGIFREDO12222
 
Engr 213 final 2009
Engr 213 final 2009Engr 213 final 2009
Engr 213 final 2009akabaka12
 
Emat 213 study guide
Emat 213 study guideEmat 213 study guide
Emat 213 study guideakabaka12
 
Inverse circular function
Inverse circular functionInverse circular function
Inverse circular functionAPEX INSTITUTE
 
Engr 213 sample midterm 2b sol 2010
Engr 213 sample midterm 2b sol 2010Engr 213 sample midterm 2b sol 2010
Engr 213 sample midterm 2b sol 2010akabaka12
 
Top School in Delhi NCR
Top School in Delhi NCRTop School in Delhi NCR
Top School in Delhi NCREdhole.com
 
Engr 213 midterm 2a sol 2010
Engr 213 midterm 2a sol 2010Engr 213 midterm 2a sol 2010
Engr 213 midterm 2a sol 2010akabaka12
 
On the Stick and Rope Problem - Draft 1
On the Stick and Rope Problem - Draft 1On the Stick and Rope Problem - Draft 1
On the Stick and Rope Problem - Draft 1Iwan Pranoto
 
Maths assignment
Maths assignmentMaths assignment
Maths assignmentNtshima
 
Limites trigonometricos1
Limites trigonometricos1Limites trigonometricos1
Limites trigonometricos1orvy
 
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)MarcelloSantosChaves
 
14257017 metode-frobenius (1)
14257017 metode-frobenius (1)14257017 metode-frobenius (1)
14257017 metode-frobenius (1)Sanre Tambunan
 
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...MarcelloSantosChaves
 
Engr 213 midterm 1a sol 2010
Engr 213 midterm 1a sol 2010Engr 213 midterm 1a sol 2010
Engr 213 midterm 1a sol 2010akabaka12
 

Tendances (20)

009 solid geometry
009 solid geometry009 solid geometry
009 solid geometry
 
Actividad 4 calculo diferencial
Actividad 4 calculo diferencialActividad 4 calculo diferencial
Actividad 4 calculo diferencial
 
Engr 213 final 2009
Engr 213 final 2009Engr 213 final 2009
Engr 213 final 2009
 
Lap lace
Lap laceLap lace
Lap lace
 
Emat 213 study guide
Emat 213 study guideEmat 213 study guide
Emat 213 study guide
 
Inverse circular function
Inverse circular functionInverse circular function
Inverse circular function
 
Engr 213 sample midterm 2b sol 2010
Engr 213 sample midterm 2b sol 2010Engr 213 sample midterm 2b sol 2010
Engr 213 sample midterm 2b sol 2010
 
Top School in Delhi NCR
Top School in Delhi NCRTop School in Delhi NCR
Top School in Delhi NCR
 
Engr 213 midterm 2a sol 2010
Engr 213 midterm 2a sol 2010Engr 213 midterm 2a sol 2010
Engr 213 midterm 2a sol 2010
 
Add Maths 2
Add Maths 2Add Maths 2
Add Maths 2
 
On the Stick and Rope Problem - Draft 1
On the Stick and Rope Problem - Draft 1On the Stick and Rope Problem - Draft 1
On the Stick and Rope Problem - Draft 1
 
Maths assignment
Maths assignmentMaths assignment
Maths assignment
 
Limites trigonometricos1
Limites trigonometricos1Limites trigonometricos1
Limites trigonometricos1
 
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)Profº Marcelo Santos Chaves   Cálculo I (limites trigonométricos)
Profº Marcelo Santos Chaves Cálculo I (limites trigonométricos)
 
14257017 metode-frobenius (1)
14257017 metode-frobenius (1)14257017 metode-frobenius (1)
14257017 metode-frobenius (1)
 
4th Semester Mechanincal Engineering (2012-December) Question Papers
4th Semester Mechanincal Engineering (2012-December) Question Papers4th Semester Mechanincal Engineering (2012-December) Question Papers
4th Semester Mechanincal Engineering (2012-December) Question Papers
 
Em10 fl
Em10 flEm10 fl
Em10 fl
 
Nts
NtsNts
Nts
 
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...
Profº. Marcelo Santos Chaves - Cálculo I (Limites e Continuidades) - Exercíci...
 
Engr 213 midterm 1a sol 2010
Engr 213 midterm 1a sol 2010Engr 213 midterm 1a sol 2010
Engr 213 midterm 1a sol 2010
 

En vedette

The Coca Cola Project
The Coca Cola ProjectThe Coca Cola Project
The Coca Cola Projectrobcohen
 
Etrilum Product Collection
Etrilum Product CollectionEtrilum Product Collection
Etrilum Product CollectionKen Yang
 
aritficial intellegence
aritficial intellegencearitficial intellegence
aritficial intellegenceAnkit Sharma
 
Etrilum Led Intro 110510
Etrilum Led Intro 110510Etrilum Led Intro 110510
Etrilum Led Intro 110510Ken Yang
 
Lect11 clipping in3d
Lect11 clipping in3dLect11 clipping in3d
Lect11 clipping in3dBCET
 
Cathode ray tube ~ankit
Cathode ray tube ~ankitCathode ray tube ~ankit
Cathode ray tube ~ankitAnkit Sharma
 
Crt
CrtCrt
CrtBCET
 

En vedette (8)

The Coca Cola Project
The Coca Cola ProjectThe Coca Cola Project
The Coca Cola Project
 
Etrilum Product Collection
Etrilum Product CollectionEtrilum Product Collection
Etrilum Product Collection
 
aritficial intellegence
aritficial intellegencearitficial intellegence
aritficial intellegence
 
Etrilum Led Intro 110510
Etrilum Led Intro 110510Etrilum Led Intro 110510
Etrilum Led Intro 110510
 
Lect11 clipping in3d
Lect11 clipping in3dLect11 clipping in3d
Lect11 clipping in3d
 
Virtual Keyboard
Virtual KeyboardVirtual Keyboard
Virtual Keyboard
 
Cathode ray tube ~ankit
Cathode ray tube ~ankitCathode ray tube ~ankit
Cathode ray tube ~ankit
 
Crt
CrtCrt
Crt
 

Similaire à Lect4 ellipse

Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipseMaaz Rizwan
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse2013901097
 
02 2d systems matrix
02 2d systems matrix02 2d systems matrix
02 2d systems matrixRumah Belajar
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdfMehulMunshi3
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptAliZaib71
 
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
 
maths jee formulas.pdf
maths jee formulas.pdfmaths jee formulas.pdf
maths jee formulas.pdfGARRYB4
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
Conic Sections
Conic SectionsConic Sections
Conic Sectionshallb76
 
Least squares support Vector Machine Classifier
Least squares support Vector Machine ClassifierLeast squares support Vector Machine Classifier
Least squares support Vector Machine ClassifierRaj Sikarwar
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmNeha Kaurav
 

Similaire à Lect4 ellipse (20)

Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
 
2.circle
2.circle2.circle
2.circle
 
Computer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipseComputer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipse
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
 
02 2d systems matrix
02 2d systems matrix02 2d systems matrix
02 2d systems matrix
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
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
 
Math report
Math reportMath report
Math report
 
maths jee formulas.pdf
maths jee formulas.pdfmaths jee formulas.pdf
maths jee formulas.pdf
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
003 circle
003 circle003 circle
003 circle
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
Conic Sections
Conic SectionsConic Sections
Conic Sections
 
Least squares support Vector Machine Classifier
Least squares support Vector Machine ClassifierLeast squares support Vector Machine Classifier
Least squares support Vector Machine Classifier
 
Lecture 9 f17
Lecture 9 f17Lecture 9 f17
Lecture 9 f17
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing Algorithm
 
Scalar and vector differentiation
Scalar and vector differentiationScalar and vector differentiation
Scalar and vector differentiation
 

Plus de BCET

Lect9 transformation3d
Lect9 transformation3dLect9 transformation3d
Lect9 transformation3dBCET
 
Lect8 viewing in3d&transformation
Lect8 viewing in3d&transformationLect8 viewing in3d&transformation
Lect8 viewing in3d&transformationBCET
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2dBCET
 
Lect6 transformation2d
Lect6 transformation2dLect6 transformation2d
Lect6 transformation2dBCET
 
Lect5 filling color_models
Lect5 filling color_modelsLect5 filling color_models
Lect5 filling color_modelsBCET
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglinesBCET
 
Lect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygonsLect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygonsBCET
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglinesBCET
 
Light pens
Light pensLight pens
Light pensBCET
 
Lcd
LcdLcd
LcdBCET
 
Graphics inputdevices
Graphics inputdevicesGraphics inputdevices
Graphics inputdevicesBCET
 
Colour models
Colour modelsColour models
Colour modelsBCET
 
Cathode ray tube
Cathode ray tubeCathode ray tube
Cathode ray tubeBCET
 
Plasma display pannel
Plasma display pannelPlasma display pannel
Plasma display pannelBCET
 
php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical HackingBCET
 

Plus de BCET (15)

Lect9 transformation3d
Lect9 transformation3dLect9 transformation3d
Lect9 transformation3d
 
Lect8 viewing in3d&transformation
Lect8 viewing in3d&transformationLect8 viewing in3d&transformation
Lect8 viewing in3d&transformation
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2d
 
Lect6 transformation2d
Lect6 transformation2dLect6 transformation2d
Lect6 transformation2d
 
Lect5 filling color_models
Lect5 filling color_modelsLect5 filling color_models
Lect5 filling color_models
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglines
 
Lect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygonsLect3 bresenham circlesandpolygons
Lect3 bresenham circlesandpolygons
 
Lect2 scan convertinglines
Lect2 scan convertinglinesLect2 scan convertinglines
Lect2 scan convertinglines
 
Light pens
Light pensLight pens
Light pens
 
Lcd
LcdLcd
Lcd
 
Graphics inputdevices
Graphics inputdevicesGraphics inputdevices
Graphics inputdevices
 
Colour models
Colour modelsColour models
Colour models
 
Cathode ray tube
Cathode ray tubeCathode ray tube
Cathode ray tube
 
Plasma display pannel
Plasma display pannelPlasma display pannel
Plasma display pannel
 
php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical Hacking
 

Lect4 ellipse

  • 1. CS 603 Computer Graphics Sudipta Mondal
  • 2. Lecture outline n Ellipse-generating algorithm n Properties of ellipse n Midpoint ellipse algorithm 2
  • 3. Ellipse Generating Algorithm n Ellipse – an elongated circle. n A modified circle whose radius varies from a maximum value in one direction to a minimum value in the perpendicular direction. n A precise definition in terms of distance from any point on the d1 ellipse to two fixed position, F1 P=(x,y) d2 called the foci of the ellipse. F2 n The sum of these two distances is the same value for all points on the ellipse. 3
  • 4. Ellipse Generating Algorithm n If the distance of the two focus positions from any point P=(x, y) on the ellipse are labeled d1 and d2, the general equation of an ellipse: d1 + d2 = constant n Expressing distance d1 and d2 in terms of the focal coordinates F1=(x1, y1) and F2=(x2, y2), we have (x - x1 )2 + ( y - y1 )2 + (x - x2 )2 + ( y - y2 )2 = constant 4
  • 5. Ellipse Generating Algorithm However, we will only consider ‘standard’ ellipse: 2 2 ry æ x - xc ö æ y - yc ö yc ç ç r ÷ +ç ÷ ç r ÷ =1 rx ÷ è x ø è y ø xc 5
  • 6. Symmetry n An ellipse only has a 4- way symmetry. (x,y) (-x,y) ry rx (x,-y) (-x,-y) 6
  • 7. Equation of an ellipse n Consider an ellipse centered at the origin, (xc,yc)=(0,0): 2 2 æxö æyö ç ÷ + ç ÷ =1 çr ÷ çr ÷ è xø è yø f e ( x, y ) = ry x + rx y - rx ry 2 2 2 2 Ellipse function 2 2 …and its properties: fellipse(x,y) < 0 if (x,y) is inside the ellipse fellipse(x,y) = 0 if (x,y) is on the ellipse fellipse(x,y) > 0 if (x,y) is outside the ellipse 7
  • 8. Midpoint Ellipse Algorithm n Ellipse is different from circle. n Similar approach with circle, different in sampling direction. Slope = -1 n Region 1: ry n Sampling is at x direction n Choose between (xk+1, yk), or rx (xk+1, yk-1) Region 1 n Move out if 2r2yx >= 2r2xy Region 2 n Region 2: n Sampling is at y direction n Choose between (xk, yk-1), or (xk+1, yk-1) 8
  • 9. Decision parameters Region 1: Region 2: p1k = f e ( xk + 1, yk - 1 2 ) p2k = fe ( xk + 12 , yk -1) p1k < 0: p2k <= 0: n midpoint is inside • midpoint is inside/on n choose pixel (xk+1, yk) • choose pixel (xk+1, yk-1) p1k >= 0: p2k > 0: n midpoint is outside/on • midpoint is outside n choose pixel (xk+1, yk-1) • choose pixel (xk, yk-1) 9
  • 10. Midpoint Ellipse Algorithm 1. Input rx, ry and ellipse center (xc, yc). Obtain the first point on an ellipse centered on the origin (x0, y0) = (0, ry). 2. Calculate initial value for decision parameter in region 1 as: 2 2 2 p1 0 = r y - rx r y + 1 4 rx 3. At each xk in region 1, starting from k = 0, test p1k : 2 2 If p1k < 0, next point (xk+1, yk) and p1k +1 = p1k + 2 ry xk +1 + ry 2 2 2 else, next point (xk+1, yk-1) and p1k +1 = p1k + 2 ry xk +1 - 2 rx y k +1 + ry with 2ry2xk+1 = 2ry2xk + 2ry2, 2rx2yk+1 = 2rx2yk – 2rx2 and repeat step 1 to 3 until 2ry2x ³ 2rx2y 10
  • 11. Midpoint Ellipse Algorithm 4. Initial value for decision parameter in region 2: p 2 0 = ry 2 (x 0 + 1 )2 + rx 2 ( y 0 - 1 )2 - rx 2 r y 2 2 where (x0, y0) is the last position calculate in region 1 5. At each yk in region 2, starting from k = 0, test p2k: 2 2 If p2k > 0, next point is (xk, yk-1) and p 2 k +1 = p 2 k - 2rx y k +1 + rx 2 2 2 else, next point is (xk+1, yk-1) and p 2 k +1 = p 2 k + 2ry xk +1 - 2rx yk +1 + rx continue until y=0 11
  • 12. Midpoint Ellipse Algorithm 6. For both region determine symmetry points in the other 3 quadrants 7. Move each calculated pixel position (x,y) onto the elliptical path centered on (xc,yc) and plot the coordinate values x=x + xc, y =y + yc 12
  • 13. Try this out! Given input ellipse k p1k (xk+1,yk+1) 2ry2 xk+1 2 rx2yk+1 parameter rx=8 and ry=6, 0 -332 (1,6) 72 768 determine pixel positions 1 along the ellipse path in 2 the first quadrant using 3 the midpoint ellipse 4 algorithm 5 6 2ry2x = ? k p2k (xk+1,yk+1) 2rv2 xk+1 2 rx2yk+1 2rx2y = 2rx2ry = ? 0 p10 = ? 1 2 13
  • 14. Plot pixel positions 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 14