Graphics Reference
In-Depth Information
Figure 6.14.
Computing the distance from a point to a
line.
AQ QP
v
v
v
v
=+
Ê
Ë
ˆ
¯
•
(6.17)
is the
unique
point of
L
that is closest to
P
. If d is the distance from
P
to
L
, then
v
v
v
v
Ê
Ë
ˆ
¯
(
)
==
d
=
dist
P L
,
PA
QP
QP
•
.
(6.18)
Alternatively,
PQ
¥
v
d =
.
(6.19)
v
Proof.
We shall only prove the first formula. The second is Exercise 6.6.1. Consider
Figure 6.14. We seek the point
A
so that
AP
is orthogonal to
v
(Theorem 4.5.12 in
[AgoM05]). The vector
wQP•
v
v
v
v
=
Ê
Ë
ˆ
¯
is the orthogonal projection of
QP
onto
L
. If
A
=
Q
+
w
, then
AP
=
QP
-
QA
=
QP
-
w
is orthogonal to
v
. Then d =|
AP
|=|
QP
-
QA
|. A solution that is concerned
with minimizing the number of arithmetic operations needed to solve the problem
can be found in [Morr91].
A straightforward generalization of Formula 6.6.1 is
6.6.2 Formula.
The distance d from a point
P
to a plane
X
which contains a point
Q
and has orthonormal basis
v
1
,
v
2
,...,
v
k
is given by
(
)
d
=
dist
PX
,
(
)
--
(
)
=
QP
QP
•
v
v
...
QP
•
v
v
(6.20)
11
kk
Furthermore,
=+
(
)
++
(
)
A
Q
QP
•
v
v
...
QP
•
v
v
(6.21)
11
k k