Graphics Reference
In-Depth Information
r is parallel to n , therefore
r = λ n
(12.2)
where λ is some scalar.
Taking the scalar product of (12.2)
. r = λ n . n
n
(12.3)
but as
r = q
p
(12.4)
. r = n . q n . p
n
(12.5)
substituting (12.1) and (12.3) in (12.5) we obtain
.
.
λ n
n =
c
n
p
(12.6)
therefore
. p + c )
n
λ =
( n
.
n
From (12.4) we get
q = p + r
(12.7)
substituting (12.2) in (12.7) we obtain the position vector for Q
q = p + λ n
The distance PQ must be the magnitude of r :
PQ =
r
=
λ n
Let's test this result with an example where the answer can be predicted.
Figure 12.9 shows a line whose equation is x + y
1 = 0, and the associated
point P (1,1). By inspection, the nearest point is Q ( 2 ,
1
2 ) and the distance
PQ =0 . 7071.
From the line equation
a =1 b =1 c =
1
therefore
2
1
1
2
λ =
=
2
therefore
1
2 × 1= 1
x Q = x P + λx n =1
2
1
2 × 1= 1
y Q = y P + λy n =1
2
The nearest point is Q ( 2 ,
1
1
2 ) and the distance is PQ =
λ n
=
2
i + j
=
0 . 7071
 
Search WWH ::




Custom Search