11.11 The Method of Separating Axes 617
complicated than that of the 2D setting, but the ideas are the same—the relative ori-
entation of the convex polyhedra to each other must be known to properly compute
the contact set. We recommend reading Section 7.7 first to understand those ideas
before finishing this section.
The
TestIntersection function can be modified to keep track of which vertices,
edges, or faces are projected to the end points of the projection interval. At the
first time of contact, this information is used to determine how the two objects are
oriented with respect to each other. If the contact is vertex-vertex, vertex-edge, or
vertex-face, then the contact point is a single point, a vertex. If the contact is edge-
edge, the contact is typically a single point, but can be an entire line segment. If the
contact is edge-face, the contact set is a line segment. Finally, if the contact is face-
face, the intersection set is a convex polygon. This is the most complicated scenario
and requires a two-dimensional convex polygon intersector. Each end point of the
projection interval is generated by either a vertex, an edge, or a face. Similar to
the implementation for the two-dimensional problem, a two-character label can be
associated with each polyhedron to indicate the projection type. The single character
labels are
V for a vertex projection, E for an edge projection, and F for a face projection.
The nine two-character labels are
VV, VE, VF, EV, EE, EF, FV, FE, and FF. The first letter
corresponds to the minimum of the interval, and the second letter corresponds to
the maximum of the interval. A convenient data structure for storing the labels, the
projection interval, and the indices of the polyhedron components that project to the
interval end points is exactly the one used in the two-dimensional problem:
Configuration
{
float min, max;
int index[2];
char type[2];
}
The projection interval is [min, max]. As an example, if the projection type is VF,
index[0] is the index of the vertex that projects to the minimum and index[1] is the
index of the face that projects to the maximum.
Two configuration objects are delcared,
Cfg0 for polyhedron C
0
and Cfg1 for
polyhedron C
1
. In the two-dimensional problem, the block of code for each poten-
tial separating direction
d had the
ComputeInterval calls replaced by ProjectNormal
and ProjectGeneral. The function ProjectNormal knows that an edge normal is being
used and only the other extreme projection must be calculated. The function
Pro-
jectGeneral
determines the projection type at both interval extremes. The analogous
functions must be implemented for the three-dimensional problem, but they apply
to the separation tests involving face normals. The separation tests for cross products
of pairs of edges require
ProjectGeneral to replace both calls to ComputeGeneral since
it is not guaranteed in these cases that only the edges project to interval extremes.