Graphics Reference
In-Depth Information
between P and the point Q corresponding to the orthogonal projection of P onto L .
Consequently, the line PQ is orthogonal to L . Because this reasoning holds for both
L 1 ( s ) with respect to L 2 and L 2 ( t ) with respect to L 1 , v must be perpendicular to both
lines. For nonparallel lines, v is unique.
The problem is now finding values for s and t satisfying these two perpendicularity
constraints:
d 1 ·
v ( s , t )
=
0
d 2 ·
v ( s , t )
=
0.
Substituting the parametric equation for v ( s , t ) gives:
d 1 ·
( L 1 ( s )
L 2 ( t ))
=
d 1 ·
(( P 1
P 2 )
+
s d 1
t d 2 )
=
0
d 2
·
( L 1 ( s )
L 2 ( t ))
=
d 2
·
(( P 1
P 2 )
+
s d 1
t d 2 )
=
0.
This can be expressed as the 2
×
2 system of linear equations
( d 1
·
d 1 ) s
( d 1
·
d 2 ) t
=−
( d 1
·
r )
( d 2
·
d 1 ) s
( d 2
·
d 2 ) t
=−
( d 2
·
r ),
where r
P 2 .
Written symbolically, in matrix notation, this corresponds to
=
P 1
a
s
t
,
b
c
=
b
e
f
where a
=
d 1
·
d 1 , b
=
d 1
·
d 2 , c
=
d 1
·
r , e
=
d 2
·
d 2 , and f
=
d 2
·
r . This system of
equations is solved, for example, using Cramer's rule to give
=
s
( bf
ce )/ d
=
t
( af
bc )/ d ,
d 1
d 2
( d 1 d 2 cos(
2
2
b 2 . Note that d
)) 2
where d
=
ae
0, in that d
=
θ
=
( d 1 d 2 sin(
)) 2 . When d
0, the two lines are parallel, which must be han-
dled separately. In this case, any point P can be selected on the one line. On the
other line, the point closest to P is selected using the projection method described in
Section 5.1.2.
θ
=
Search WWH ::




Custom Search