This was a very quick project I did a few years back.
It deals with the problem of simulating cloth, thin objects that are deformable and, in some cases, even tearable. These kind of simulations are usually too expensive for massive use in games or other real-time applications, but they provide a nice graphical effect.
My implementation is very basic and was hacked together within one evening, so it’s neither fast nor elegant. It works by dividing the cloth into a regular grid, placing particles at grid corners and then connecting particles using quasi-stiff springs. The particles are then moved using simple position verlet integration and then constrained by correcting the length of each spring to its original length. Combined with a simple raypicking function for cylinders, cubes and spheres, this gives some neat effects despite its simplicity.
Download (*.exe & code): Cloth Simulation