0% found this document useful (0 votes)
16 views

Mid Point Elliplse Algorithm

The document describes the mid-point ellipse algorithm for drawing ellipses on a graph. It provides pseudocode for the algorithm that takes the center point and x- and y-radii of the ellipse as inputs. The algorithm uses a decision parameter P that is updated in a repeating loop to determine the points along the ellipse edge that are drawn to the screen.

Uploaded by

Vidit Gautam
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Mid Point Elliplse Algorithm

The document describes the mid-point ellipse algorithm for drawing ellipses on a graph. It provides pseudocode for the algorithm that takes the center point and x- and y-radii of the ellipse as inputs. The algorithm uses a decision parameter P that is updated in a repeating loop to determine the points along the ellipse edge that are drawn to the screen.

Uploaded by

Vidit Gautam
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

www.eazynotes.

com

Gursharan Singh Tatla

Page No. 1

MID POINT ELLIPSE ALGORITHM


Mid-Point Elliplse ( XC, YC, RX, RY):
Description: Here XC and YC denote the x coordinate and y coordinate of the center of the ellipse and RX and RY denote the x radius and y radius respectively. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. Else Set X = X + 1 Set PX + 2 * RYSq Set P = P + RXSq PY + PX Else Set Y = Y 1 Set PY = PY 2 * RXSq Set P = P + RYSq + PX PY [End of If] Call Draw Elliplse(XC, YC, X, Y) [End of Step 7 While] Set P = RYSq*(X + 0.5)2+RXSq*(Y 1)2RXSq*RYSq Repeat While (Y > 0) Set Y = Y 1 Set PY = PY 2 * RXSq If (P > 0) Then Set P = P + RXSq PY [Region 2] Set RXSq = RX * RX Set RYSq = RY * RY Set X = 0 and Y = RY Set PX = 0 and PY = 2 * RXSq * Y Call Draw Elliplse(XC, YC, X, Y) Set P = RYSq (RXSq * RY) + (0.25 * RXSq) Repeat While (PX < PY) Set X = X + 1 PX = PX + 2 * RYSq If (P < 0) Then Set P = P + RYSq + PX [Region 1]

www.eazynotes.com

Gursharan Singh Tatla

Page No. 2

[End of If] 27. 28. Exit Call Draw Ellipse(XC, YC, X, Y) [End of Step 18 While]

Draw Ellipse ( XC, YC, X, Y):

1. 2. 3. 4. 5.

Call PutPixel(XC + X, YC + Y) Call PutPixel(XC - X, YC + Y) Call PutPixel(XC + X, YC - Y) Call PutPixel(XC - X, YC - Y) Exit

You might also like