Simulation  Masssprings Cloth
Path of the code: [08_cloth]
 A cloth surface is modeled as a mesh where vertices are initially placed on a regular grid.
 So far, only the weight (and a drag/friction force) is applied on the particles.
 Two vertices are constrained to remain fixed (see the variable positional_constraints to remove/add new positional constraints).

  A set of GUIbased controlers on the time scale multiplicator applied on \(h\), stiffness, damping, mass, and wind force. These parameters are available inside the code (only time scale is used in the initial code).

  The possibility to desactivate the cloth texture and display the wireframe, which may be helpfull for debugging.
 An automatic check is performed after each numerical integration to detect a possible divergence of the system (detect_simulation_divergence). In such case, the simulation is stopped (with an error message on the command line).
Adding spring forces
The objective is to implement the network of springs able to model the behavior of a cloth. > Add the forces related to springs in the function compute_forces.

  Add first the forces of structural springs only and make sure that you get a plausible behavior before adding more forces. Using wireframe mode with slow time step and coarse mesh (few particles) can help debugging if something is wrong.
  Then add forces modeled by shearing and bending springs.
 Consider a spring of stifness \(K\) and rest length \(L_0\) attached between a point \(p_i\) and \(p_j\). The force exerted by the spring on the point \(p_i\) is

 \({\bf F}=  K (\p_ip_j\L_0) \frac{p_ip_j}{\p_ip_j\} \)
 Note the effect of spring stiffness and mass on the resulting simulation.

 You may add more springs, linking for instance 2, or 3neighborhood, if you want to model more rigid and smooth behavior for higher resolution meshes.
 > Implement the collision detection and response with respect to the ground and the sphere in the function collision_constraints. Note that the parameters of the radius and position of the sphere as well as the height of the ground are available in the variable collision_shapes.
 > Implement the action of the wind. How do you model such force ?