Skip to content

Physical Simulation

keenancrane edited this page Dec 6, 2017 · 7 revisions

The next task is to implement an integrator for the (undamped) wave equation across a mesh:

For this part of the assignment, you may assume that the mesh is always a triangle mesh.

We've discussed in class how to calculate the Discrete Laplacian operator, via the cotan-formula:

There is an additional note for evaluating this cotangent here: Evaluating cotan

For this task, you should update Vertex::Laplacian in halfedgeMesh.cpp and Mesh::forwardEuler and Mesh::symplecticEuler in dynamic_scene/mesh.cpp, storing your calculated u value in Vertex::offset and the calculated u' value in Vertex::velocity. Be careful about when you update these quantities. Note that since forward Euler is defined to solve a single, first-order differential equation, solving a second-order one will require you to break it up into 2 first order equations and solve each of them with forward Euler.

The next task is to change your intergrators to solve the damped wave equation across a mesh: Where we call the damping factor, which can take on any value between 0 and 1. You'll notice here that a damping factor of 0 is identical to the undamped case.

Once you've implemented these integrators, you can switch between them with F and S, change the timestep with - and =, and the damping factor with SHIFT/- and SHIFT/=. Be aware that Forward Euler is not numerically stable, so if your solutions blow up then it's the expected behavior.


You may find it easier to initially test this behavior on one of the simpler meshes from media/meshedit. The images below show a sample output on bean.dae at the 10th and 100th frame of animation, note that the damping factor of 0.01 causes the waves to dissipate.

Clone this wiki locally