Graphics Reference
In-Depth Information
The equations
The state of an object can be kept in a heterogeneous structure called the state vector , S ( t ), consisting of
its position, orientation, linear momentum, and angular momentum ( Eq. 7.46 ). Object attributes, which
do not change over time, include its mass, M , and its object-space inertia tensor, I object . At any time, an
object's time-varying inertia tensor, angular velocity, and linear velocity can be computed
(Eqs. 7.47-7.49). The time derivative of the object's state vector can now be formed ( Eq. 7.50 ).
2
3
x
ðtÞ
RðtÞ
PðtÞ
LðtÞ
4
5
SðtÞ¼
(7.46)
T
IðtÞ¼RðtÞI object RðtÞ
(7.47)
oðtÞ¼IðtÞ 1
LðtÞ
(7.48)
PðtÞ
M
vðtÞ¼
(7.49)
2
4
3
5 ¼
2
4
3
5
x
ðtÞ
RðtÞ
PðtÞ
LðtÞ
v ðtÞ
oðtÞ RðtÞ
F
d
dt SðtÞ¼
d
dt
(7.50)
ðtÞ
tðtÞ
This is enough information to run a simulation. Once the ability to compute the derivative infor-
mation is available, then a differential equation solver can be used to update the state vector. In the
simplest implementation, Euler's method can be used to update the values of the state array. The values
of the state vector are updated by multiplying their time derivatives by the length of the time step. In
practice, Runge-Kutta methods (especially fourth-order) have found popularity because of their trade-
off in speed, accuracy, and ease of implementation.
Care must be taken in updating the orientation of an object. Because the derivative information from
earlier is only valid instantaneously, if it is used to update the orientation rotation matrix, then the col-
umns of this matrix can quickly become nonorthogonal and not of unit length. At the very least, the
column lengths should be renormalized after being updated. A better method is to update the orienta-
tion matrix by applying to its columns the axis-angle rotation implied by the angular velocity vector,
o ( t ). The magnitude of the angular velocity vector represents the angle of rotation about the axis along
the angular velocity vector (see Appendix B.3.3 for the axis-angle calculation). Alternatively, quater-
nions can be used to represent both the object's orientation and the orientation derivative, and its use
here is functionally equivalent to the axis-angle approach.
7.4.2 Bodies in collision
When an object starts to move in any kind of environment other than a complete void, chances are that
sooner or later it will bump into something. If nothing is done about this in a computer animation, the
object will penetrate and then pass through other objects. Other types of contact include objects sliding
against and resting on each other. All of these types of contact require the calculation of forces in order
to accurately simulate the reaction of one object to another.
 
Search WWH ::




Custom Search