Graphics Reference
In-Depth Information
n 1
P
n 2
n 1 × n 2
p 2
p 1
Figure 5.30 The intersection of two planes.
in the plane equations forms a 2
×
2 system of linear equations.
n 1 ·
( k 1 n 1 +
k 2 n 2 )
=
d 1
n 2
·
( k 1 n 1
+
k 2 n 2 )
=
d 2 .
By virtue of the linearity of the dot product, this is equivalent to
k 1 ( n 1 ·
n 1 )
+
k 2 ( n 1 ·
n 2 )
=
d 1
k 1 ( n 1 ·
n 2 )
+
k 2 ( n 2 ·
n 2 )
=
d 2 ,
which can be solved for k 1 and k 2 (by Cramer's rule, for example) to give the solution
k 1 =
( d 1 ( n 2 ·
n 2 )
d 2 ( n 1 ·
n 2 ))/ denom
k 2 =
( d 2 ( n 1 ·
n 1 )
d 1 ( n 1 ·
n 2 ))/ denom ,
where
n 2 ) 2 .
denom
=
( n 1
·
n 1 )( n 2
·
n 2 )
( n 1
·
A direct implementation of these expressions gives the following code.
// Given planes p1 and p2, compute line L = p+t*d of their intersection.
// Return 0 if no such line exists
 
Search WWH ::




Custom Search