Game Development Reference

In-Depth Information

We show in Listing 10.1 a pseudocode of how to build this barycentric matrix.

Then, we can easily compute the barycentric coordinates; for example, the first

barycentric coordinate
ξ
1
is computed as

ξ
1
=
α
1
+
α
2
p
1
,x
+
α
3
p
2
,y
+
α
4
p
3
,z
,

(10.9)

and therefore its partial derivative, required to compute one of the entries of
B
e
,

is simply

∂ξ
1

∂x

=
α
2
,

(10.10)

since the element's shape functions are linear and constant. Thus, all the entries in

the displacement-deformation matrix of Equation (10.5) are computed similarly

given the following constant matrix:

⎡

⎣

⎤

⎦

α
2

00
β
2

00
γ
2

00
δ
2

00

0

α
3

00
β
3

00
γ
3

00
δ
3

0

00
α
4

00
β
4

00
γ
4

00
δ
4

B
e
=

.

α
3

α
2

0

β
3

β
2

0

γ
2

γ
3

0

δ
2

δ
3

0

0

α
4

α
3

0

β
4

β
3

0

γ
4

γ
3

0

δ
4

δ
3

α
4

0

α
2

β
4

0

β
2

γ
4

0

γ
2

δ
4

0

δ
2

Finally, substituting
B
e
into Equation (10.4), we obtain

ˆ

ε
=
B
e
u
e
.

Refer to Listing 10.2 for the corresponding pseudocode.

10.3.2 Static System

When an elastic object is deformed by stretching it or compressing it, it stores an

energy that tries to restore the object to its original shape. One way to describe

this behavior is by seeking the mechanical equilibrium of the object. Recall that

the object has been discretized into many subregions, in our case tetrahedrons,

and that for each tetrahedron the displacement field has been written in terms of

the nodal values, which we have used to find the linear relationship between the

stress and the strains. Introducing this into the strain-energy function restricted to

the node displacements, we get the static equilibrium given by

f
ext
=
K
e
u
e
,

where
f
ext
are the external forces applied to the nodes of the tetrahedron and
u
e

the displacements of the nodes. The matrix
K
e
is known as the
stiffness matrix