0% found this document useful (0 votes)
13 views6 pages

C59 Exp2b

Uploaded by

nikhilkindre1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

C59 Exp2b

Uploaded by

nikhilkindre1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Terna Engineering College

Computer Engineering Department


Program: Sem IV

Course: Computer Graphics

Faculty: Prof.Pradnya Jadhav


LAB Manual
PART A
Experiment No.02
A.1 Aim:
Implement Midpoint EllipseDrawing algorithm.

A.2 Prerequisite:
1. C Language

A.3 Outcome:
After successful completion of this experiment students will
be able to

Implement various line, circle, ellipse drawing algorithms.

A.4 Theory:

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

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

1. Call PutPixel(XC + X, YC + Y)

2. Call PutPixel(XC - X, YC + Y)

3. Call PutPixel(XC + X, YC - Y)

4. Call PutPixel(XC - X, YC - Y)

5. Exit

PARTB
Roll No. C-59 Name: Nikhil Girish Kindre
Class : SE C Comps Batch : C3
Date of Experiment: 27 Aug 2024 Date of Submission
Grade :

B.1 Document created by the student:


B.2 Observations and learning:

The Midpoint Ellipse Drawing Algorithm uses integer calculations to efficiently


plot ellipse points. It divides the ellipse into two regions and adjusts decision
parameters to determine pixel positions, reducing computation compared to
floating-point methods.

B.3 Conclusion:

The Midpoint Ellipse Drawing Algorithm is an efficient method for rasterizing


ellipses, leveraging integer arithmetic to simplify calculations and enhance
performance. It provides a balance between accuracy and computational efficiency,
making it well-suited for real-time graphics applications.

You might also like