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. Set RXSq = RX * RX
2. Set RYSq = RY * RY
3. Set X = 0 and Y = RY
4. Set PX = 0 and PY = 2 * RXSq * Y
5. Call Draw Elliplse(XC, YC, X, Y)
6. Set P = RYSq – (RXSq * RY) + (0.25 * RXSq) [Region 1]
7. Repeat While (PX < PY)
8. Set X = X + 1
9. PX = PX + 2 * RYSq
10. If (P < 0) Then
11. Set P = P + RYSq + PX
12. Else
13. Set Y = Y – 1
14. Set PY = PY – 2 * RXSq
15. Set P = P + RYSq + PX – PY
[End of If]
16. Call Draw Elliplse(XC, YC, X, Y)
[End of Step 7 While]
17. Set P = RYSq*(X + 0.5)^2 + RXSq*(Y – 1)^2 – RXSq*RYSq [Region 2]
18. Repeat While (Y > 0)
19. Set Y = Y – 1
20. Set PY = PY – 2 * RXSq
21. If (P > 0) Then
22. Set P = P + RXSq – PY
23. Else
24. Set X = X + 1
25. Set PX + 2 * RYSq
26. Set P = P + RXSq – PY + PX
[End of If]
27. Call Draw Ellipse(XC, YC, X, Y)
[End of Step 18 While]
28. Exit
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. Set RXSq = RX * RX
2. Set RYSq = RY * RY
3. Set X = 0 and Y = RY
4. Set PX = 0 and PY = 2 * RXSq * Y
5. Call Draw Elliplse(XC, YC, X, Y)
6. Set P = RYSq – (RXSq * RY) + (0.25 * RXSq) [Region 1]
7. Repeat While (PX < PY)
8. Set X = X + 1
9. PX = PX + 2 * RYSq
10. If (P < 0) Then
11. Set P = P + RYSq + PX
12. Else
13. Set Y = Y – 1
14. Set PY = PY – 2 * RXSq
15. Set P = P + RYSq + PX – PY
[End of If]
16. Call Draw Elliplse(XC, YC, X, Y)
[End of Step 7 While]
17. Set P = RYSq*(X + 0.5)^2 + RXSq*(Y – 1)^2 – RXSq*RYSq [Region 2]
18. Repeat While (Y > 0)
19. Set Y = Y – 1
20. Set PY = PY – 2 * RXSq
21. If (P > 0) Then
22. Set P = P + RXSq – PY
23. Else
24. Set X = X + 1
25. Set PX + 2 * RYSq
26. Set P = P + RXSq – PY + PX
[End of If]
27. Call Draw Ellipse(XC, YC, X, Y)
[End of Step 18 While]
28. Exit
No comments:
Post a Comment