Here are concise lecture notes on the Ellipse Drawing Algorithm, useful for teaching
Computer Graphics or preparing for exams.
Ellipse Drawing Algorithm – Lecture Notes
1. Introduction
An ellipse is a set of points such that the sum of the distances from two fixed points
(foci) is constant.
In computer graphics, ellipses are commonly used in design tools, games, and
simulations.
2. Ellipse Equation
The standard ellipse equation centered at the origin:
x2a2+y2b2=1\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1
where:
o aa = semi-major axis (horizontal radius),
o bb = semi-minor axis (vertical radius).
3. Symmetry in Ellipse
The ellipse is symmetric about both x- and y-axes.
To reduce computation, draw points in one quadrant and mirror them to others.
4. Midpoint Ellipse Drawing Algorithm
This is an efficient incremental rasterization algorithm using integer operations.
4.1. Region Division
Ellipse is divided into two regions:
Region 1: Slope of the ellipse < 1 (dy/dx<1dy/dx < 1)
Region 2: Slope ≥ 1 (dy/dx≥1dy/dx ≥ 1)
5. Algorithm Steps
Initial Conditions
Start at point (0,b)(0, b)
Initial decision parameter for Region 1:
p1=b2−a2b+14a2p_1 = b^2 - a^2b + \frac{1}{4}a^2
Region 1 (dy/dx < 1):
While 2b2x<2a2y2b^2x < 2a^2y:
o Plot the four symmetric points.
o If p1<0p_1 < 0, increment x, update p1p_1
o Else increment x, decrement y, update p1p_1
Transition to Region 2:
Initial decision parameter:
p2=b2(x+0.5)2+a2(y−1)2−a2b2p_2 = b^2(x + 0.5)^2 + a^2(y - 1)^2 - a^2b^2
Region 2 (dy/dx ≥ 1):
While y≥0y ≥ 0:
o Plot the four symmetric points.
o If p2>0p_2 > 0, decrement y, update p2p_2
o Else increment x, decrement y, update p2p_2
6. Pseudocode Summary
void drawEllipse(int a, int b) {
int x = 0, y = b;
float p1 = b*b - a*a*b + 0.25*a*a;
// Region 1
while ((2*b*b*x) < (2*a*a*y)) {
plot(x, y);
if (p1 < 0) {
x++;
p1 += 2*b*b*x + b*b;
} else {
x++; y--;
p1 += 2*b*b*x - 2*a*a*y + b*b;
}
}
// Region 2
float p2 = b*b*(x + 0.5)*(x + 0.5) + a*a*(y - 1)*(y - 1) - a*a*b*b;
while (y >= 0) {
plot(x, y);
if (p2 > 0) {
y--;
p2 -= 2*a*a*y + a*a;
} else {
x++; y--;
p2 += 2*b*b*x - 2*a*a*y + a*a;
}
}
}
7. Advantages
Utilizes only integer operations (fast).
Efficient for rendering ellipses in raster displays.
Exploits symmetry for fewer calculations.
8. Applications
Drawing ovals in vector graphics
Clock dials, radar charts
Object boundaries in image processing
9. Sample Diagram
*
* *
* *
* *
*
(Symmetric ellipse drawn quadrant-wise)
Let me know if you want:
MCQs or short/long questions
PPT slides
PDF version
Implementation in Python or C++