Game Development Reference
In-Depth Information
When these are satisfied, the vector n (1) has no projection in the u (2) - v (2) plane,
asshowninFigure9.1.
The content of the constraint is that n (1) and n (2) are both normal to the
u (2) - v (2) plane, which means they are parallel, and thus, by transitivity, n (2)
is a normal to the u (1) - v (1) plane as well. But the indicator function in Equa-
tion (9.1) is satisfied simultaneously for both n (1)
n (2) ,
i.e., the antiparallel case. But we usually want the first of the two options. This is
shown below in Figure 9.2.
It is possible to flip between one and the other by wrenching the two bodies
hard enough, irrespective of our numerical method of choice. In addition, the
constraint weakens as it gets further and further away from the desired config-
uration. It is, in fact, metastable when vector n (1) lies in the u (2) - v (2) plane
since the Jacobian vanishes there, and so it might stabilize either the right way or
the wrong way. That makes them easy to flip since the constraint force starts to
weaken at π/ 4, and it starts to point the wrong way after π/ 2. We could avoid
such headaches using reduced coordinate formulations, as is common in robotics,
but that will cause other types of pain. As an aside, we might think that the in-
dicator n (1)
= n (2) and n (1)
=
n (2) =cos θ =0, which is a single equation, is equally good as
the two equations in Equation (9.1). The problem is that this single equation is,
in fact, quadratic, i.e., it behaves as θ 2 near θ =0, which means that the Jacobian
vanishes.
The remedy to that is to construct indicators with a unique zero, and this can
be done using quaternions. These indicators have extreme values
·
1 precisely
when one of the normal vectors used in the dot product definition is flipped by
180 . One problem remains though. The Jacobians still vanish at the maximum
constraint violation, and that means they weaken on the way there. It is possible
to add nonlinear terms to the indicator functions to fix this problem. But that's
±
Good!
n (1)
n (1)
v (1)
v (1)
n (2)
v (2)
¯
v (2)
¯
u (2)
u (1)
u (1)
u (2)
¯
n (2)
Figure 9.2. Axis flip.