Game Development Reference
In-Depth Information
If we bring over the sum of the radii-squared terms to the left side of the equation
and then apply a little more substitution, we will get an equation that may seem
familiar:
You might recall that this type of equation can be solved using the quadratic equa-
tion, which you may have not used in years:
The value under the radical, known as the
discriminant
, is especially important.
There are three ranges of note: less than zero, equal to zero, and greater than zero.
If the discriminant is less than zero, there is no real solution for
t
, which in this
case means no intersection occurs. If the discriminant is equal to zero, it means
that the spheres tangentially touch at exactly one value of
t
. If the discriminant is
greater than zero, it means that the objects do fully intersect, and the smaller of the
two quadratic solutions (the - in ±) is the
t
where the initial intersection occurs.
All three of these scenarios are illustrated in
Figure 7.12
.