The answer depends on the actual details of the algorithm.
Region codes:
LRBT form
P1(10,20) : 1000
P2(70,80) : 0001
P1 != 0, P2 != 0, P1 & P2 = 0
Slope:
m = (P1y - P2y) / (P1x - P2x) = (80 - 20) / (70 - 10) = 1
m != 0, m != inf
Intersections:
P1(10,20), just left bit != 0
L: x = Ax, y = P1y + m(Ax - P1x) = 15 - 10 + 20 = 25, y >= Ay, y <= Cy
P2(70,80), just top bit != 0
T: y = Cy, x = P2x + 1/m (Cy - P2y) = 70 + 60 - 80 = 50, x >= Ax, x <= Cx
Conclusion:
I1(15,25) and I2(50,60) are the clipped points.
Comments
Leave a comment