Graphics Reference
In-Depth Information
Y
Y
1
1
X
X
1
2
1
2
−
1
−
1
(b)
(a)
Fig. 10.22.
(a) Shows two line segments intersecting, and (b) shows two line segments
touching.
therefore
t
=
1(1
0)
(0
−
0)(1
.
5
−
1
.
5)
−
(2
−
1)(1
−
(
−
1))
−
(
−
1)) + 1
.
5(0
−
1) + 1
.
5(
−
1
−
t
=
2
−
1
.
5
−
1
.
5
=0
.
5
−
2
and
1(
−
1
−
0) + 2(0
−
(
−
1)) + 1
.
5(0
−
0)
s
=
0)
=0
.
5
(1
−
(
−
1))(2
−
1)
−
(1
.
5
−
1
.
5)(0
−
Substituting
t
and
s
in (10.44) we get (
x
i
,y
i
)=(1
.
5
,
0
.
0), as predicted.
•
Example 2
. Figure 10.22b shows two line segments touching at (1.5, 0.0).
The coordinates of the line segments are
(
x
1
,y
1
)=(1
,
0)
(
x
2
,y
2
)=(2
,
0)
(
x
3
,y
3
)=(1
.
5
,
0
.
0)
(
x
4
,y
4
)=(1
.
5
,
1
.
0)
therefore
1(1
.
0
−
0
.
0) + 1
.
5(0
.
0
−
1
.
0) + 1
.
5(0
.
0
−
0
.
0)
(0
.
0
t
=
−
0
.
0)(1
.
5
−
1
.
5)
−
(2
.
0
−
1
.
0)(1
.
0
−
0
.
0)
t
=
1
.
0
−
1
.
5
=0
.
5
−
1
.
0
1(0
−
0) + 2(0
−
0) + 1
.
5(0
−
0)
s
=
(1
−
0)(2
−
1)
−
(1
.
5
−
1
.
5)(0
−
0)
s
=
0
1
=0
The zero value of
s
confirms that the lines touch, rather than intersect, and
t
=0
.
5 confirms that the touching takes place halfway along the line segment.