- 2082 Kartik (new course) · 2+5 marks
Ellipse symmetry and drawing algorithm
Short answer
An ellipse has four-way symmetry about the axes, so computing only the first quadrant yields four pixels per point, reducing work. The midpoint ellipse algorithm splits the quadrant at slope -1: region 1 steps x, uses p1=ry²−rx²·ry+rx²/4; region 2 steps y, initial p2=ry²(x+0.5)²+rx²(y−1)²−rx²ry², then plots (±x,±y) shifted to center.
How is the symmetric property vital while drawing an ellipse? Write an algorithm to draw an ellipse in raster graphics system.
Symmetry in ellipse drawing
An ellipse centred at the origin is symmetric about the x-axis and the y-axis. So if (x, y) is a point on the ellipse, then (−x, y), (x, −y) and (−x, −y) are also on it. This four-way symmetry means only the first quadrant needs to be calculated, and every calculated point gives 4 pixels, reducing the computation to one fourth. (Unlike a circle, an ellipse has no symmetry about y = x.)
Midpoint ellipse algorithm (rx, ry, centre (xc, yc))
The first quadrant is divided into region 1 (slope magnitude < 1, x is the unit step) and region 2 (slope magnitude ≥ 1, y is the unit step). The boundary is where 2ry²x = 2rx²y. The ellipse function f(x, y) = ry²x² + rx²y² − rx²ry² is tested at the midpoint of the two candidate pixels.
Input rx, ry and centre (xc, yc).
Region 1 (slope magnitude < 1):
x = 0, y = ry
p1 = ry² − rx²·ry + rx²/4
while 2·ry²·x < 2·rx²·y:
plot the 4 symmetric points of (x, y)
x = x + 1
if p1 < 0:
p1 = p1 + 2·ry²·x + ry²
else:
y = y − 1
p1 = p1 + 2·ry²·x − 2·rx²·y + ry²
Region 2 (slope magnitude ≥ 1), start from last (x, y):
p2 = ry²(x + ½)² + rx²(y − 1)² − rx²·ry²
while y ≥ 0:
plot the 4 symmetric points of (x, y)
y = y − 1
if p2 > 0:
p2 = p2 − 2·rx²·y + rx²
else:
x = x + 1
p2 = p2 + 2·ry²·x − 2·rx²·y + rx²
Each plotted point is shifted by (xc, yc): (xc±x, yc±y).
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Symmetry property of a circle · Computer Graphics, chapter 2 · asked 4×
- Process of drawing an ellipse · Computer Graphics, chapter 2
- Raster versus vector graphics · Computer Graphics, chapter 1 · asked 4×
- Pixel access rate of raster system · Computer Graphics, chapter 1
- Compare DDA/Bresenham; midpoint ellipse · Computer Graphics, chapter 2
- Raster display and frame buffer load time · Computer Graphics, chapter 1
- Isometric crystal system with symmetry elements · Engineering Geology I, chapter 3 · asked 5×
- Axis of symmetry; isometric system · Engineering Geology I, chapter 3
- CTFT conjugation and conjugate symmetry · Signals and Systems, chapter 3 · asked 2×
- Harmonic exponentials; CTFS conjugate symmetry · Signals and Systems, chapter 2