Graphics Reference
In-Depth Information
Let L i be the line determined by the segment [ Q i , Q i+1 ]. Define intervals I i = [a i ,b i ]
as follows:
Case 1:
L is parallel to L i .
(a) If L lies entirely in H i , then let I i = (-•, +•).
(b) If L lies entirely outside of H i , then let I i = f.
Case 2:
L is not parallel to L i .
In this case L will intersect L i in some point P = P 1 + t i P 1 P 2 . We distinguish
between the case where the line L “enters” the halfplane H i and where the
line “exits” H i .
(a) (Line enters) If P 1 P 2 N i ≥ 0, then let I i = [t i , +•).
(b) (Line exits) If P 1 P 2 N i < 0, then let I i = (-•, t i ].
See Figure 3.4, where a segment S = [ P 1 , P 2 ] is being clipped against a triangle Q 1 Q 2 Q 3 .
Note that finding the intersection point P in Case 2 is easy. All we have to do is solve
the equation
(
) =
NP PPQ
i
+
t
-
0
1
1
2
i
for t.
Now let I 0 = [a 0 ,b 0 ] = [0,1]. The interval I 0 is the set of parameters of points which
lie is S . It is easy to see that the interval
k
max
I
=
I
i
i
=
0
= [
]
a
, min
b
i
i
0
££
ik
0
££
ik
= [
]
ab
,
Figure 3.4.
Cyrus-Beck line clipping.
Search WWH ::




Custom Search