Mass-spring model cloth simulation with gravity, wind, and collision
This simulation uses a mass-spring model with each vertex representing a single point mass, or particle. The particles are arranged in a 2D matrix iterconnected by bending, structural, and shear springs. Springs are objects with two particle pointers and accelerations are calculated for the entire particle sheet before calculating each particle's movement using Verlet integration.
In order to prevent over and under extension of the springs, a variation of the Gauss-Seidel method was used. Since all computations were performed on the CPU without GPU aid, between 7 and 20 iterations were used in order to find a good balance between elasticity and frame rate. I believe the video below is using 7 iterations per frame on a 30x30 particle sheet.
If you'd like to see the code, check it out on GitHub.
Cloth colliding with sphere