Game Development Reference

In-Depth Information

where
K
g
is the global stiffness matrix that is built by summing up all the

stiffness matrices of the tetrahedron. Although
K
e
is built only at the be-

ginning, the global matrix has to be built each time the object is deformed.

Similarly, the forces at the tetrahedron nodes are summed up to compute

the global vector
f
g
0
.

Therefore, at each time step, we need to solve the system given by Equa-

tion (10.17), where we have to invert the matrix
S
=
M
+
h
D
+
h
2
K
by

...

e

⎡

⎣

⎤

⎦

R
e
(
t
)
K
e,
1
,
1
R
e
(
t
)
−
1

R
e
(
t
)
K
e,
1
,n
R
e
(
t
)
−
1

e

.

.
.
.

K
g
(
t
)=

...

e

R
e
(
t
)
K
e,n,
1
R
e
(
t
)
−
1

R
e
(
t
)
K
e,n,n
R
e
(
t
)
−
1

e

and

⎡

⎣

⎤

⎦

f
e,
1

e

.

f
g
0
(
t
)=

.

f
e,n

e

Remember that we can accelerate the simulation by precomputing the stiffness

matrices
K
e
.

Computing the tetrahedron rotation.
The corotational formulation algorithm

needs to compute the rotations of the mesh elements in each simulation step.

Before showing how to obtain the rotations of the elements, we need to know

how to compute the transformation
T
(
p
) of the four nodes of the tetrahedron.

Hence, let
P
e
be the matrix made by the position of the nodes in the tetrahedron

e
at its rest position:

⎡

⎤

1

1

1

1

⎣

⎦

p
1
,x

p
2
,x

p
3
,x

p
4
,x

,

P
e
=

p
1
,y

p
2
,y

p
3
,y

p
4
,y

p
1
,z

p
2
,z

p
3
,z

p
4
,z

and similarly, let
C
e
be the matrix made up of the tetrahedron nodes in the de-

formed positions. Then, using Equations (10.6), (10.7), (10.8), and (10.9), we can

obtain

T
(
p
)=
C
e
P
−
e
p
=
T
p,

(10.19)

where
T
=
C
e
P
−
1

is the transformation matrix.

e