Game Development Reference
In-Depth Information
Figure 4.14. Two-dimensional Gauss map of the contact area. If we sample every 90
(left), we may randomly miss some vertices with a 90 internal angle or more, like vertex
w .Ifwesampleevery 45 (right), we may only miss vertices with a 135 angle.
To find sampling directions, generate two directions u and v orthogonal to the
normal and each other. The i th sampling direction is
n i = n + u cos 2 πi
n
+ v sin 2 πi
n
tan (threshold)
It's not normalized because, for finding the support vertex, it doesn't need to
be. For fixed n , it's very fast to compute these directions. The normal must be
pointing away from the shape, so the sampling directions will have opposite-sign
normals for the shapes.
After we sample the directions, we'll end up with n vertices, some of them
the same. To weed out the duplicates, all we need to do is go through the array
and check the vertices sequentially: for each vertex i , remove it from the array if
the previous vertex ( i
1) is too close. We can only check one vertex because we
kept the sequence of sampling directions.
4.6.8 Step 3: Intersect the Contact Areas
Once we have the contact areas, we need to find the actual contact manifold by
intersecting the contact areas.
1. Contact point. The simplest case of the contact manifold (besides having
no contact at all) is just one contact point. If we only have one point from
either shape (see Figure 4.5(a ) , (d), and (e)), we conclude that the contact
manifold consists of only one point, and we have that point's coordinates