click and drag to manipulate the cloth the simulation sometimes breaks if it moves too fast
this works very similarly to my elastic rope simulation. the difference is that it can handle pulling pushing from two different joints, for each joint. the simulation is changing the velocity of the joints to try and get them to be the correct distance (stored in the "spacing" variable) from their four neighbouring joints, but at the same time, gravity and friction are being applied. the joint positions and velocities are stored on four "2d" arrays.