Skip to main content

Digitize ellipse Rx=12, Ry=7

Short answer

With rx=12, ry=7, center (19,10), using midpoint algorithm: region 1 from (0,7) to (10,4), region 2 to (12,0). Shifted points: (19,17), (20,17), (21,17), (22,17), (23,17), (24,16), (25,16), (26,16), (27,15), (28,15), (29,14), (30,13), (30,12), (31,11), (31,10).

Digitize the ellipse with radius Rx = 12 and Ry = 7 and center (19, 10).

Given: rx = 12, ry = 7, centre (19,10). Compute the first quadrant about the origin, then use 4-way symmetry and shift by the centre.

rx² = 144, ry² = 49, 2rx² = 288, 2ry² = 98
Start (0, 7)
p1_0 = ry² − rx²·ry + rx²/4 = 49 − 1008 + 36 = −923
Region 1 (while 2ry²x < 2rx²y):
  p1 < 0 : p1 += 2ry²·x_new + ry²                     (y same)
  p1 ≥ 0 : y−−; p1 += 2ry²·x_new − 2rx²·y_new + ry²

Region 1

k(x_k, y_k)p1_k2ry²·x2rx²·y
0(0,7)-92302016
1(1,7)-776982016
2(2,7)-5311962016
3(3,7)-1882942016
4(4,7)2533922016
5(5,6)-9364901728
6(6,6)-2995881728
7(7,6)4366861728
8(8,5)-1717841440
9(9,5)7608821440
10(10,4)6379801152

At (11,3): 2ry²x = 1078 ≥ 2rx²y = 864, so region 2 starts at (11,3).

p2_0 = 49(11.5)² + 144(2)² − 144·49 = 6480.25 + 576 − 7056 = 0.25
Region 2:  p2 > 0 : x same, p2 += rx² − 2rx²·y_new
           p2 ≤ 0 : x++,    p2 += 2ry²·x_new − 2rx²·y_new + rx²

Region 2

k(x_k, y_k)p2_k
0(11,3)0.25
1(11,2)-431.75
2(12,1)600.25
3(12,0)744.25

First-quadrant points about the origin: (0,7), (1,7), (2,7), (3,7), (4,7), (5,6), (6,6), (7,6), (8,5), (9,5), (10,4), (11,3), (11,2), (12,1), (12,0).

Adding the centre (19,10) to (x, y) gives the first quadrant pixels:

(19,17), (20,17), (21,17), (22,17), (23,17), (24,16), (25,16), (26,16), (27,15), (28,15), (29,14), (30,13), (30,12), (31,11), (31,10)

The other three quadrants are (19−x, 10+y), (19+x, 10−y), (19−x, 10−y) for each point above.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 2 questions →