SlideShare a Scribd company logo
1 of 6
COMPUTER GRAPHICS
MidPoint Ellipse Drawing Algorithm
By: Ms. Rachana Marathe
Algorithm: Ellipse drawing
Input (rx, ry) centered at origin and the first point is (x0,y0)=(0,ry)
Region 1 :
P10 = ry
2 – rx
2 ry +1/4 rx
2
If p1k < 0 then (xk+1, yk) and
P1k+1 = p1k +2ry
2 xk+1 + ry
2
Else (xk+1, yk-1)
P1k+1 = p1k +2ry
2 xk+1 - 2rx
2 yk+1 + ry
2
And continue till 2ry
2 x >= 2rx
2 y
Region 2:
Here (x0,y0) is the last point calculated in region1
P20= ry
2 (x0 +1/2)2 +rx
2 (y0 -1)2 - rx2ry2
If P2k >0 then (xk, yk-1) and
P2k+1 = p2k -2rx
2 yk+1 + rx
2
Else (xk+1, yk-1)
P2k+1 = p2k +2ry
2 xk+1 - 2rx
2 yk+1 + rx
2
Till y=0, i.e. last point is (rx,0)
Example 1: rx = 10, ry= 5
Algorithm: Region 1
P10 = ry
2 – rx
2 ry +1/4 rx
2
If p1k < 0 then (xk+1, yk)
And P1k+1 = p1k +2ry
2 xk+1 + ry
2
Else (xk+1, yk-1)
And P1k+1 = p1k +2ry
2 xk+1 - 2rx
2 yk+1 + ry
2
And continue till 2ry
2 x >= 2rx
2 y
Solution: (x0,y0)=(0,ry) = (0,5)
rx2 = 100 ry2 = 25 2rx2 = 200 2ry2 = 50
P10 = ry
2 – rx
2 ry +1/4 rx
2 = -450
(x,y) = (1,5) (if case)
P1k+1 = p1k +2ry
2 xk+1 + ry
2 = -375
(x,y) = (2,5) (if case)
P1k+1 = p1k +2ry
2 xk+1 + ry
2 = -250
(x,y) = (3,5) (if case)
P1k+1 = p1k +2ry
2 xk+1 + ry
2 = -75
(x,y) = (4,5) (if case)
P1k+1 = p1k +2ry
2 xk+1 + ry
2 = 150
(x,y) = (5,4) (else case)
P1k+1 = p1k +2ry
2 xk+1 - 2rx
2 yk+1 + ry
2 = -375
(x,y) = (6,4) (if case)
Algorithm: Region 2
Here (x0,y0) is the last point calculated in region1
P20= ry
2 (x0 +1/2)2 +rx
2 (y0 -1)2 - rx2ry2
If P2k >0 then (xk, yk-1)
And P2k+1 = p2k -2rx
2 yk+1 + rx
2
Else (xk+1, yk-1)
And P2k+1 = p2k +2ry
2 xk+1 - 2rx
2 yk+1 + rx
2
Till y=0, i.e. last point is (rx,0)
Solution: the first point will be the last (x,y) of region 1
(x,y)= (9,2)
P20= ry
2 (x0 +1/2)2 +rx
2 (y0 -1)2 - rx2ry2 = -143.75
(x, y) = (10,1) (else case)
P2k+1 = p2k +2ry
2 xk+1 - 2rx
2 yk+1 + rx
2 = 131.25
(x, y) = (10,0) (if case)
We STOP here when we reach (rx,0)
Therefore the pixels are
(0,5) (1,5) (2,5) (3,5) (4,5) (5,4) (6,4) (7,4) (8,3) (9,2) (10,1) (10,0)
Reference
Hearn,Baker - Computer Graphics - C Version 2nd Ed
http://edu.uokufa.edu.iq/staff/dr.nidhal/compressed%20comp.book/H
earn,Baker%20-%20Computer%20Graphics%20-
%20C%20Version%202nd%20Ed.pdf

More Related Content

What's hot

Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmRuchi Maurya
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
2D Transformation
2D Transformation2D Transformation
2D TransformationShahDhruv21
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithmPooja Dixit
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
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
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithmMani Kanth
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmArvind Kumar
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solvedKuntal Bhowmick
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmMrinmoy Dalal
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsDrishti Bhalla
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...rohitjasudkar
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithmPooja Dixit
 

What's hot (20)

Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
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
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping Algorithm
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 

Similar to Comuter graphics ellipse drawing algorithm (20)

Computer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipseComputer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipse
 
Circle algorithm
Circle algorithmCircle algorithm
Circle algorithm
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notes35182797 additional-mathematics-form-4-and-5-notes
35182797 additional-mathematics-form-4-and-5-notes
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Lect4 ellipse
Lect4 ellipseLect4 ellipse
Lect4 ellipse
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Modul 3 quadratic function
Modul 3 quadratic functionModul 3 quadratic function
Modul 3 quadratic function
 
Maths05
Maths05Maths05
Maths05
 
Basic m4-2-chapter1
Basic m4-2-chapter1Basic m4-2-chapter1
Basic m4-2-chapter1
 
Comuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithmComuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithm
 
10CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 610CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 6
 
Ejerciciosderivadasresueltos
EjerciciosderivadasresueltosEjerciciosderivadasresueltos
Ejerciciosderivadasresueltos
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
MA8353 TPDE
MA8353 TPDEMA8353 TPDE
MA8353 TPDE
 
Unit 3
Unit 3Unit 3
Unit 3
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
 

Recently uploaded

Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 

Comuter graphics ellipse drawing algorithm

  • 1. COMPUTER GRAPHICS MidPoint Ellipse Drawing Algorithm By: Ms. Rachana Marathe
  • 2. Algorithm: Ellipse drawing Input (rx, ry) centered at origin and the first point is (x0,y0)=(0,ry) Region 1 : P10 = ry 2 – rx 2 ry +1/4 rx 2 If p1k < 0 then (xk+1, yk) and P1k+1 = p1k +2ry 2 xk+1 + ry 2 Else (xk+1, yk-1) P1k+1 = p1k +2ry 2 xk+1 - 2rx 2 yk+1 + ry 2 And continue till 2ry 2 x >= 2rx 2 y Region 2: Here (x0,y0) is the last point calculated in region1 P20= ry 2 (x0 +1/2)2 +rx 2 (y0 -1)2 - rx2ry2 If P2k >0 then (xk, yk-1) and P2k+1 = p2k -2rx 2 yk+1 + rx 2 Else (xk+1, yk-1) P2k+1 = p2k +2ry 2 xk+1 - 2rx 2 yk+1 + rx 2 Till y=0, i.e. last point is (rx,0)
  • 3. Example 1: rx = 10, ry= 5 Algorithm: Region 1 P10 = ry 2 – rx 2 ry +1/4 rx 2 If p1k < 0 then (xk+1, yk) And P1k+1 = p1k +2ry 2 xk+1 + ry 2 Else (xk+1, yk-1) And P1k+1 = p1k +2ry 2 xk+1 - 2rx 2 yk+1 + ry 2 And continue till 2ry 2 x >= 2rx 2 y Solution: (x0,y0)=(0,ry) = (0,5) rx2 = 100 ry2 = 25 2rx2 = 200 2ry2 = 50 P10 = ry 2 – rx 2 ry +1/4 rx 2 = -450 (x,y) = (1,5) (if case) P1k+1 = p1k +2ry 2 xk+1 + ry 2 = -375 (x,y) = (2,5) (if case) P1k+1 = p1k +2ry 2 xk+1 + ry 2 = -250 (x,y) = (3,5) (if case) P1k+1 = p1k +2ry 2 xk+1 + ry 2 = -75 (x,y) = (4,5) (if case) P1k+1 = p1k +2ry 2 xk+1 + ry 2 = 150 (x,y) = (5,4) (else case) P1k+1 = p1k +2ry 2 xk+1 - 2rx 2 yk+1 + ry 2 = -375 (x,y) = (6,4) (if case)
  • 4. Algorithm: Region 2 Here (x0,y0) is the last point calculated in region1 P20= ry 2 (x0 +1/2)2 +rx 2 (y0 -1)2 - rx2ry2 If P2k >0 then (xk, yk-1) And P2k+1 = p2k -2rx 2 yk+1 + rx 2 Else (xk+1, yk-1) And P2k+1 = p2k +2ry 2 xk+1 - 2rx 2 yk+1 + rx 2 Till y=0, i.e. last point is (rx,0) Solution: the first point will be the last (x,y) of region 1 (x,y)= (9,2) P20= ry 2 (x0 +1/2)2 +rx 2 (y0 -1)2 - rx2ry2 = -143.75 (x, y) = (10,1) (else case) P2k+1 = p2k +2ry 2 xk+1 - 2rx 2 yk+1 + rx 2 = 131.25 (x, y) = (10,0) (if case) We STOP here when we reach (rx,0)
  • 5. Therefore the pixels are (0,5) (1,5) (2,5) (3,5) (4,5) (5,4) (6,4) (7,4) (8,3) (9,2) (10,1) (10,0)
  • 6. Reference Hearn,Baker - Computer Graphics - C Version 2nd Ed http://edu.uokufa.edu.iq/staff/dr.nidhal/compressed%20comp.book/H earn,Baker%20-%20Computer%20Graphics%20- %20C%20Version%202nd%20Ed.pdf