Page 76 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 76
Lab on Computer Graphics
Notes increment x
PlotEllipse(x c , y c , x, y)
end while
//Set initial values in region II
P = P – (a (4y – 3) + b (4x + 3) + 2)/4
2
2
// Intentionally + 2 to round off the value
∆P = a (3 – 2y)
2
S
2
∆P = 2b + 3a 2
SE
∆ 2 P = 2a 2
S
//Plot the pixels in region II
While y > 0
If P > 0 then //Select S
P = P + ∆P E
∆P = ∆P + ∆ P S
E
2
E
SE
2
SE
∆P = ∆P + ∆ P S
else // Select SE
P = P + ∆P SE
∆P = ∆P + ∆2P S
E
E
2
∆P = ∆P + ∆ P SE
SE
SE
Increment x
end if
decrement by
PlotEllipse (x c , y c , x, y)
end while
end DrawEllipse
Self Assessment Questions
1. In working with a lattice of points it is useful to avoid floating point arithmetic.
(a) True (b) False
2. ……………….. method is modified from Bresenham’s algorithm.
(a) Bresenham’s ellipse drawing algorithm
(b) Bresenham’s algorithm
(c) Midpoint ellipse algorithm
(d) None of these
3. The curve is divided into two regions. In region I, the slope on the curve is………….
(a) less than –1 (b) equal 1
(c) less than –2 (d) greater than –1
4. Consider the general equation of an ellipse:
(a) b 2 x 2 – a 2 y 2 – a 2 b 2 = 0
(b) b 2 x 2 + a 2 y 2 – a 2 b 2 = 0
(c) b 2 x 2 + a 2 y 2 + a 2 b 2 = 0
(d) b 2 x 2 + a 2 y 2 – x 2 y 2 = 0
70 LOVELY PROFESSIONAL UNIVERSITY