Professional Documents
Culture Documents
33 Experiment 4
33 Experiment 4
The midpoint ellipse algorithm efficiently draws ellipses in computer graphics by iteratively determining
boundary points. It uses symmetry properties to calculate points within the ellipse's quarter and mirrors
them for the other quarters. With initial parameters and a decision parameter, the algorithm adjusts x
and y coordinates based on conditions, generating accurate ellipse representations on pixel grids.
While newer methods exist, the midpoint algorithm remains a foundational technique for ellipse
rendering.
Algorithm
Step 1: Start
x=0 , y = ry
dx = 2 ry2 x
dy = 2 rx2 y
Plot (x,y)
if(P < 0)
Update x = x+1 ;
P += ry2 [2x + 3 ]
Else
Update x = x + 1
y= y - 1
1
TSEC Batch:- S1-2 AI&DS Name:- AARYA GURAV Roll No:-33
Computer Graphics Lab Experiment No: - 04
If (P2 > 0)
P2 = P2 -2 y rx2 + rx2
else
x = x+1
y = y-1
Code
2
TSEC Batch:- S1-2 AI&DS Name:- AARYA GURAV Roll No:-33
Computer Graphics Lab Experiment No: - 04
3
TSEC Batch:- S1-2 AI&DS Name:- AARYA GURAV Roll No:-33
Computer Graphics Lab Experiment No: - 04
Output
Conclusion: LO is mapped
4
TSEC Batch:- S1-2 AI&DS Name:- AARYA GURAV Roll No:-33