What is this

Methods

Sequence

  1. Initialize position of particles and parameters
  2. Loop
    1. Initialize force of each particle
    2. Update force of each particle from spring
    3. Update position of each particle
    4. Satisfy distance constraints of each strut
    5. Update collision of ground

Each Particles

  • f = Mg

Spring

  • $f=K_s(l-l_0)d+K_d(v_1・d-v_0・d)d$
  • $K_s$ : spring constant
  • $l$ : current length
  • $l_0$ : rest length
  • $d$ : unit vector toward the other particle
  • $K_d$ : damper constant
  • $v_0$,$v_1$ : velocity of particles

Update particles

  • Verlet Integration
  • $x_{n+1} ← $
    • $ xn+(xn-x_{n-1})+Δt^2F_n/m$
    • xn is $x_n$ (it is rendering error)

Strut

  • $x_0$ ← $(x_0 + x_1)/2.0$ - $(l_0/2.0)$ $d$
    • d : the unit vector toward the other particle
    • $l_0$ is the rest length.
  • This update does not move the center of gravity of the strut.

Update collision of graound

If the z value of a particle is under the particle radius, the particle have to jump. I use the Position-based method for collision against the ground.

  • $ z_{n+1} = r $
  • $ zn ← r + z_{n+1} - zn $
    • zn is $z_n$ (it is rendering error)

z is the z position of a particle. r is the radius of particles.

For x, y, I add friction for collision.

  • $xn=xn+(x_{n+1}-xn)(1.0-u)$$
  • $yn = yn + (y_{n+1} - yn)(1.0 - u) $

Parameters

  • item Common value

    • $M$ = 0.20
    • $\Delta t$ = 0.010
    • $r$ = 5.0
    • $u$ = 0.80
  • video1

    • $x$ = (-400.0, 200.0, 250.0)
    • $v$ = (-0.70, 0.80, 0.50)
    • $ K_s$ = 20.0
    • $ K_b$ = 5.0
    • $ g $ = -9.8
  • Video2

    • $x$ = (-500.0, 800.0, 250.0)
    • $v$ = (-0.30, 1.00, 0.40)
    • $ K_s$ = 20.0
    • $ K_b$ = 5.0
    • $ g $ = -9.8
  • Video3

    • $x$ = (-500.0, 800.0, 250.0)
    • $v$ = (-0.30, 1.00, 0.40)
    • $ K_s$ = 20.0
    • $ K_b$ = 5.0
    • $ g $ = -0.98
  • Video4

    • $x$ = (-500.0, 800.0, 250.0)
    • $v$ = (-0.30, 1.00, 0.40)
    • $ K_s$ = 1.1
    • $ K_b$ = 0.6
    • $ g $ = -0.98

make movie

  • run
    • make
    • make run
  • make movie
    • cd bin/data
    • ffmpeg -r 200 -i image %05d.png -vcodec libx264 -pix fmt yuv420p -r 200 out.mp4