K =1 , left ; K=2, right; K=3, bottom; K=4, top For AC, ∆y <0 , ∆x < 0,
K=1, p1 = ∆x is +ve u2 = min[ 1, q1/p1, q3/p3] = q1/p1 K=2, p2 = ∆x is –ve u1 = max[0, q2/p2, q4,p4] = q2/p2 K = 3, p3 = -∆y is +ve => goes to u2
K=4, p4 = ∆y is –ve => goes to u1 u2>u1
Note, u1 corresponds t1 and u2 corresponds to t4
Similarly, do it for BD. The algorithm returns NULL here.
C
D
B t1
t4
t3
2.
LEFT Clipping:
Starting from V3, {I3, V4, V5, I6, I3}
Staring from V7, {I7, V1, I2, I7}
RIGHT Clipping:
On 1st polygon,
Starting from V4, {I5, I6, I3, I4, I5}
On 2nd Polygon,
Starting from V1, {I1, I2, I7, I8, I1}
I2
I7 I6
I3
I6 I3
I7 I2
I1 I8 I5
I4
using the Ellipse mid-point algorithm,
(a) The cross over point from region R1 to R2.
(b) The points drawn in region R2 only.
a = 10, b = 6
dint=b*b+a*a(.25-b) = 36-100*5.75 = -539 x = 1 y = 6
shift from R1 to R2 happens when 36(x+1)>=100(y-0.5) or, 50y-18x<=43 1 d<0 d = dold+b*b(2x+3) = -539+36*3 = -431 X = 1 Y = 6 2 d<0 d = dold+b*b(2x+3) = -431+36*5 = -251 X = 2 Y = 6
3 d<0 d = dold+b*b(2x+3) = -251+36*7 = 1 X = 3 Y = 6
4 d>0 d = dold+b*b(2x+3)+a*a(-2y+2) = 1+36*9+100*(-10) = -675
X = 4 Y = 5
5 d<0 d = dold+b*b(2x+3) = -675+36*11 = -279 X=5 Y=5
6 d<0 d = dold+b*b(2x+3) = -279+36*13 = 189 X = 6 Y = 5 7 d>0 d = dold+b*b(2x+3)+a*a(-2y+2)
= 189+36*15-100*8 = -71
X = 7 Y = 4
8 d<0 d = dold+b*b(2x+3) = -71+36*17 = 541 X = 8 Y = 3 50*y-18*x = 50*3-18*8 = 6<43. Hence, move to R2
dint = b*b*(x+0.5)*(x+0.5)+a*a*(y-1)*(y-1)-a*a*b*b = 36*8.5*8.5 +100*2*2 -3600 = -599
9 d<0 d = d+b*b*(2x+2)+a*a*(-2y+3) = -599+36*18+100*(-3) = -251
X = 9 Y = 2
10 d<0 d = d+b*b*(2x+2)+a*a*(-2y+3) = -251 +36*20 +100*(-1) = 369
X = 10 Y = 1
11 d>0 d = d+a*a(-2y+3) = 369+100*1 = 469 X = 10 Y = 0
4. In polygon filling algorithm, derive the sequence of intersection points for an edge from (0,0) to (4,9) of a polygon using the method of integer update.
∆y =9, ∆x = 4, C = min(∆x, ∆y) = 4 Scan line 1: C = 4
Scan line2: C = 4+4 = 8 Scan line 3: C = 4+8 = 12 > ∆y
C= 12 - ∆y = 3, 1st Intersection point (1,3)
Scan line 4: C = 3 + 4 = 7 Scan line 5: C = 4 +7 = 11 > ∆y
C= 11 - ∆y = 2, 2nd Intersection point (2,5)
Scan line 6: C = 2 + 4 = 6 Scan line 7: C = 4 +6 = 10 > ∆y
C= 10 - ∆y = 1, 3rd Intersection point (3,7)
Scan line 8: C = 1 + 4 = 5 Scan line 9: C = 4 +5 = 9 = ∆y
C= 9 - ∆y =0, 5th Intersection point (4,9), (0,0)
(4,9)
1 Scan lines 2
(1,5), (7,10), (11, 0), (18, 10), (24, 0), (26,10), (31, 0), (33,5), (26, 15), (21, 10), (16, 15), (9,10), (6, 15).
10
5
0 10 11 -4/10 10 11 7/10 10 24 -6/10
10 24 2/10 10 31 -5/10 4 31 2/5
15 33 -7/10
15 9 -3/5 15
0
9 7/5 15 21 -5/5 15 21 5/5
LM KL JK IJ
10 1 6/5
AB
15 1 5/10
MA HI
BC CD DE
EF FG GH
(type 2 vertex, H)