乐趣区

关于后端:COMS-W4167基于物理计算

COMS W4167: Physically Based Computer Animation
Theme IV, Milestone I – Elastic Simulation
Due 22:00:00 PM Tuesday 23th Nov 2021 (EST)
Academic Honesty Policy
You are permitted and encouraged to discuss your work with other students. Except where explicitly stated
otherwise, you may work out equations in writing on paper or a whiteboard. You are encouraged to use
Piazza to converse with other students, the TAs, and the instructor.
HOWEVER, you may NOT share source code or hard copies of source code. Refrain from activities or
the sharing materials that could cause your source code to APPEAR TO BE similar to another student’s
enrolled in this or previous years. We will be monitoring source code for individuality. Cheating will be
dealt with severely. Source code should be yours and yours only. Do not cheat. For more details, please
refer to the full academic honesty policy on the departmental website and on Piazza.
1 Introduction
In Theme IV, we’ll tackle the elastic body problem. Simulation of the elastic material is based on formulation
of an elastic energy that is quadratic in a strain that describes how the object is deformed. Using different
aspects of the deformation as our strain, we can capture different modes of deformation in the energies, and
thus obtain the forces that counter-act these modes. In this milestone we’ll examine three elastic forces:
spring force, bending force, and the constant-strain-triangle (CST) force.
2 New XML Features
This milestone introduces the following new simulation features:

  1. The elasticbodyspringforce feature specifies a spring force:

The i1 and i2 attributes specify between which particles this force acts; note that different than the
spring force we implemented in the first theme, this force does not require an edge between the two
endpoints. The alpha attribute specifies the material’s elastic modulus (equivalent to EA where E is
the young’s modulus and A is the area of the cross-section of the spring). The l0 attribute specifies
the rest length which means the same as the spring in theme I.

  1. The elasticbodybendingforce feature specifies a bending force:

The i1, i2 and i3 attributes specify between which particle this force acts. To represent a bending
deformation we need three particles, where the second one is the hinge. The alpha attribute specifies
the material’s elastic modulus in resisting the bending mode. The theta0 attribute specifies the rest
angle in radian.

  1. The elasticbodycstforce feature specifies a CST force:
    ebyy=”0″ ebxy=”0″ xb1x=”0″ xb1y=”0″ xb2x=”1″ xb2y=”0″ xb3x=”0″ xb3y=”1″/>
    1
    Figure 1: The deformation map.
    The i1, i2 and i3 attributes specify the three vertices of the triangle where this force acts. The
    youngsmodulus and poisonratio attributes are the material parameters. ebxx, ebxy and ebyy encodes
    the“resting strain”ˉ that is discussed in the next section. xb1x and xb1y specify the undeformed
    position of vertex 1, and xb2x, xb2y, xb3x and xb3y are similar.
  2. Kinematics
    3.1 The Deformation Map and Deformation Gradient
    The kinematics of a deforming material are represented by a deformation mapping Φ : R2 → R2 taking every
    ‘undeformed’material point x on the plane to its corresponding deformed position Φ(x). In general, Φ is
    an arbitrary nonlinear map taking 2 coordinates denoting a position to a new set of 2 coordinates denoting
    some other position.
    Now we’d like to know how much this deformation is stretching, compressing or shearing the material.
    Since a generic deformation is an arbitrary nonlinear map, we only look at each point locally (by examining
    its infinitesimal neighborhood). Consider a point xˉ in the undeformed space, and a nearby point xˉ + δxˉ.
    The deformed position are x and x + δx, and by definition of Φ we have:
    x = Φ(xˉ)
    x + δx = Φ(xˉ + δxˉ)
    = Φ(xˉ) +?Φ(xˉ)δxˉ +O(‖δxˉ‖2)
    δx = ?Φ(xˉ)δxˉ +O(‖δxˉ‖2)
    Φ(xˉ) is the Jacobian of the transformation Φ evaluated at xˉ, often called the Deformation Gradient.
    The high order terms in the end can be omitted because we assume δxˉ is infinitesimal.
    3.2 The Strain
    Now we are ready to evaluate how much lengths change after such a transformation. Under the assumption
    that δxˉ is infinitesimal, the line from xˉ to xˉ+δxˉ in the undeformed space remains a line after the deformation,
    2
    going from x to x+ δx. Therefore the lengths of this piece of material before and after deformation are ‖δxˉ‖
    and ‖δx‖ respectively. For the ease of computation we look at the change in squared length (so as to avoid
    taking square roots):
    δxT δx? δxˉT δxˉ = (?Φ(xˉ)δxˉ)T (?Φ(xˉ)δxˉ)? δxˉT δxˉ
    = δxˉT?Φ(xˉ)T?Φ(xˉ)δxˉ? δxˉT δxˉ
    = δxˉT [?Φ(xˉ)T?Φ(xˉ)? I]δxˉ
    The reason we can use change in squared length instead of change in length itself as a measure of stretching
    is that, to the first order, they are equivalent as long as the deformation is small. In order to make this
    change in squared length a scale-invariant representation of relative stretching/compression, we extract out
    the term in the middle, [?Φ(xˉ)T?Φ(xˉ)? I], and call it the strain, or .
    This strain is a second-order tensor, unlike the 1D case where a single scalar fully describes how much a
    spring is stretched as shown in class two weeks ago. In 2D materials can be stretched differently in different
    directions, so a second-order tensor is needed. The physical meaning of this tensor is that when you hit
    it on both sides with a direction δxˉ, it returns a change in squared length in that direction. In its matrix
    representation, the eigenvectors of this matrix are the two directions that are stretched or compressed the
    most, and the corresponding eigenvalues tell you how much the stretching/compression is in that direction.
    Another interesting thing to note is that is rotation-invariant, even though ?Φ is not. As a measure
    of deformation, the strain should not depend on any rigid motion such as translation and rotation. It is
    obvious that ?Φ, which is the result of a spatial differential operator, stays the same under translation, but
    what about rotation? To test this, we apply a constant rotation Q to any deformation Φ to obtain a new
    deformation Φ?, and see how responds:
    Thus we’ve convinced ourselves that our strain is invariant under any rigid motions, therefore it qualifies
    as a measure of deformation.
    3.3 Example Deformation
    Let’s look at an example with real numbers. Consideration an affine deformation of a rectangular sheet of
    rubber as in Figure 2. This rectangle is stretched along the green axis by 80%, and compressed along the
    red axis by 40%. This means our deformation map Φ is multiplication by a matrix with two eigenvalues: 1.8
    corresponding to the eigenvector (3, 1) (green axis), and 0.6 corresponding to the eigenvector (-1, 3) (red
    axis). Therefore Φ looks like this:
    Figure 2: An example deformation of square, with stretching in one direction and compression in the other.
    The two arrows denote the two eigenvectors of the strain tensor with corresponding eigenvalues (λ1 and λ2)
    marked on the arrows.
    We can compute the strain tensor from Φ:
    It is easy to verify that this 2×2 matrix has eigenvalues 2.24 and -0.64, corresponding to a 80% stretching
    (1.82 1 = 2.24) and a 40% compression (0.62 ? 1 = ?0.64).
  3. Physics
    The strain tensor gives us a complete description of the deformation of the material, but it doesn’t tell us
    how the material will respond. That is out of the scope of kinematics, and we have to put in some ingredients
    from physics. Here in this section we’ll attempt to write down the energy that arises from the deformation,
    which governs how the simulation will take place in time. For this purpose, we can proceed in either a
    mechanics-oriented way, or a mathematics-oriented way.
    4.1 The Mathematical Way
    Imagine we have somehow obtained the energy function w of strain , we can take its Taylor expansion:
    w(0) is a constant independent of and can be conveniently assume to be 0. The linear term is also
  4. because the energy should be minimized at zero strain (the definition of“resting shape”). If we adopt
    the small strain assumption, the higher order terms can be omitted since the energy is dominated by the
    quadratic term. This is basically saying, no matter how complicated the material laws are, under the small
    strain assumption we can always write down the energy as a quadratic function of the strain.
    4.2 The Mechanical Way
    Physically, the energy is equal to the product between the stress and the strain:
退出移动版