Graphics Reference
In-Depth Information
where p 1 and p 2 are position vectors to their respective points. Once more,
we can write the coordinates of any point P as follows:
x p = x 1 + t ( x 2
x 1 )
y p = y 1 + t ( y 2
y 1 )
z p = z 1 + t ( z 2
z 1 )
(10.62)
10.6.2 Point of Intersection of Two Straight Lines
Given two straight lines we can test for a point of intersection, but must be
prepared for three results:
a real intersection point
no intersection point
an infinite number of intersections (identical lines).
If the line equations are of the form
p = a 1 + r b 1
p = a 2 + s b 2
(10.63)
for an intersection we can write
a 1 + r b 1 = a 2 + s b 2
(10.64)
which yields
x a 1 + rx b 1 = x a 2 + sx b 2
y a 1 + ry b 1 = y a 2 + sy b 2
z a 1 + rz b 1 = z a 2 + sz b 2
(10.65)
We now have three equations in two unknowns, and any value of r and s must
hold for all three equations. We begin by selecting two equations that are
linearly independent (i.e. one equation is not a scalar multiple of the other)
and solve for r and s , which must then satisfy the third equation. If this
final substitution fails, then there is no intersection. If all three equations are
linearly dependent, they describe two parallel lines, which can never intersect.
To check for linear dependency we rearrange (10.65) as follows:
rx b 1
sx b 2 = x a 2
x a 1
ry b 1
sy b 2 = y a 2
y a 1
rz b 1
sz b 2 = z a 2
z a 1
(10.66)
If the determinant ∆ of any pair of these equations is zero, then they are de-
pendent. For example, the first two equations of (10.66) form the determinant
Search WWH ::




Custom Search