Graphics Reference
In-Depth Information
v 1
v 0
C 1
C 0
r 1
r 0
(a)
v 0
C 1
C 0
- v 1
v 0 - v 1
(b)
C 1
C 0
r 0 + r 1
v 0 - v 1
(c)
Figure 5.35 Recasting the moving sphere-sphere test as a ray intersection test. (a) The original
problem of intersecting a moving sphere against a moving sphere. (b) Transforming problem
into a moving sphere versus a stationary sphere. (c) Reduced to a ray test against a stationary
sphere of larger radius.
sphere into one with a combined radius of r 0
r 1 (Figure 5.35c). The problem now
becomes that of intersecting a ray with a static sphere, for which a routine was given
in Section 5.3.2. The implementation is now straightforward.
+
int TestMovingSphereSphere(Sphere s0, Sphere s1, Vector v0, Vector v1, float &t)
{
// Expand sphere s1 by the radius of s0
s1.r += s0.r;
 
Search WWH ::




Custom Search