Graphics Reference
In-Depth Information
A
Q
P
B
r
Figure 5.26 The line, ray, or segment specified by points A and B is intersected against the
cylinder given by points P and Q and the radius r .
cylinder surface can be stated as satisfying the implicit equation
v
·
d
r 2
(
v
w
) · (
v
w
)
=
0,
where v
=
X
P , d
=
Q
P ,
and w
=
d d .
d
·
This equation simply states that when taking the vector v from P to a point X
and subtracting w (the component of v parallel to d ) the resulting vector (which is
perpendicular to d , the direction of the cylinder) must have a length equal to r for X
to be on the cylinder surface. The equation has been squared to avoid a square root
term, which simplifies further processing.
The intersection of a line L ( t )
A ), defined by the points A and B
(Figure 5.26), with the cylinder can be found by substituting L ( t ) for X in the previous
equation and solving for t . Writing v
=
A
+
t ( B
=
L ( t )
P
=
( A
P )
+
t ( B
A )as v
=
m
+
t n ,
with m
=
A
P and n
=
B
A , after some manipulation the equation turns into
n
t 2
2 m
t
·
d ) 2
·
·
·
d ) 2
( n
( n
d )( m
d )
( m
r 2
·
+
·
+
·
=
n
n
m
m
0.
d
·
d
d
·
d
d
·
d
The repeated division by d
·
d can be eliminated by multiplying both sides by d
·
d ,
giving
( d
d ) 2 t 2
2 ( d
d ) t
r 2 )
·
d )( n
·
n )
( n
·
+
·
d )( m
·
n )
( n
·
d )( m
·
+
( d
·
d )(( m
·
m )
d ) 2
( m
·
=
0.
 
Search WWH ::




Custom Search