General Collision Detection for Games Using Ellipsoids

# Making It Ellipsoidal

The radius for an ellipsoid cannot be defined by a single value. Rather, it is defined by something called the radius vector. For an ellipse (the 2D version of an ellipsoid), the radius vector might look something like this:
Figure 14: An ellipse with its radius vector

Figure 14 shows an ellipse with a radius vector of [3,6]. This results in an ellipse that is 6 units wide and 12 units tall.

If you were to add any unit vector to a point, you would end up with a point on the surface of a unit sphere, centered on that point. If you were to scale that unit vector by the radius vector of an ellipsoid, you would end up with a point on the surface of that ellipsoid.

Here抯 an example in two dimensions:
Figure 15: Using the radius vector to scale a unit circle to an ellipse

Figure 15 shows a unit circle with the vector [0.707, 0.707] ?a 2-dimensional unit vector. When multiplied (component wise) by our radius vector [3, 6] we end up with a new vector [2.12, 4.242], which is then used to scale the circle to an ellipse. This, of course, extends perfectly into three dimensions.

In an earlier section, we discussed how to calculate the sphere intersection point by inverting the plane抯 normal, setting its length to the radius of the sphere and adding this to the center point of the sphere. We抮e going to change this just a little. For ellipsoids, we抣l use the plane抯 normal (a unit vector) invert it, scale it by the radius vector and finally add it to the source point. This results in our ellipsoid intersection point. This is a rather small change, which allows us to use ellipsoids rather than spheres for our calculations.

Before we can consider our collisions with ellipsoids complete, we must also remember that our ray/sphere intersection must really be a ray/ellipsoid intersection.

Thus, we are now able to collide with ellipsoids, rather than simple spheres. Sliding, gravity, everything else continues to work the same.