Graphics Reference
In-Depth Information
you can easily convert between them. If we have two lines whose intersection
we need to compute, we could do an implicit-implicit, parametric-parametric, or
parametric-implicit computation. The implicit-implicit version is messy enough
that it's better to convert one line to parametric form and use the implicit-
parametric intersection approach. We'll begin by computing the intersection of
two lines in parametric form, mostly so that you see the benefit of the later
implicit-parametric form. In general, we find that intersections between implicit
and parametric forms tend to produce the simplest algebra.
7.7.1 Parametric-Parametric Line Intersection
Suppose we have two lines in parametric form, that is, two functions
R 2 : t
γ
: R
tA +( 1
t ) B ,
(7.72)
h
(1)
D
R 2 : s
η
: R
sC +( 1
s ) D ,
(7.73)
A
whose images are (respectively) the line AB and the line CD (see Figure 7.13).
We'd like to find the point P where these lines intersect. That point will lie on the
line determined by
g (0)
P
h (0)
γ
, that is, it will be
γ
( t 0 ) for some real number t 0 ; similarly,
B
C
it'll be
η
( s 0 ) for some real number s 0 . Equating these gives
g
(1)
Figure 7.13: The lines AB and
CD are the images of the para-
metric functions γ and η ;they
intersect at the unknown point P.
t 0 A +( 1
t 0 ) B = s 0 C +( 1
s 0 ) D ,
(7.74)
which can also be written
B
D =
t 0 ( A
B )+ s 0 ( C
D ) ,
(7.75)
which is a nice form because it involves only vectors (i.e., differences between
points).
If we write out Equation 7.74 in terms of the known coordinates of the points
A , B , C , and D , we get two equations in the two unknowns s 0 and t 0 and can
solve for them. We can then compute P by computing either t 0 A +( 1
t 0 ) Bor
s 0 C +( 1
s 0 ) D .
An alternative, and preferable, approach is to use the vector form shown in
Equation 7.75. Letting v = A
B and u = C
D ,wehave
B
D =
t 0 v + s 0 u .
(7.76)
Taking the dot product of both sides with
×
v , we get
( B
D )
·
(
×
v )=
t 0 v
·
(
×
v )+ s 0 u
·
(
×
v )
(7.77)
( B
D )
·
(
×
v )= s 0 u
·
(
×
v )
(7.78)
( B
D )
·
(
×
v )
= s 0
(7.79)
u
·
(
×
v )
where the simplification arises because
v is perpendicular to v , so their dot prod-
uct is zero. The last trick—eliminating a term from an equation by taking the dot
product of both sides with a vector orthogonal to that term—is often useful.
×
 
 
Search WWH ::




Custom Search