CSE 683: Lab #77
tentatively Due Monday, Nov. 15
LAB 7: Spring-mass-damper mesh flag
ASSIGNMENT
Implement a 10x10 spring-mass-damper mesh to simulate a flag: the mesh should be in the x-y plane.
Fix the leftmost vertices in space.
Implement gravity and a pseudo-random wind field as global forces.
Getting a spring-damper system to behave the way you want it to requires trial-and-error to set the appropriate values for time-delta, mass, spring constant, damper constant, and wind strength.
Suggestions:
- code it so you can easily change the resolution of the 'cloth' (helps to use low-res cloth when debugging)
- display with a checkerboard pattern - alternate colors for each grid of cloth, or some other interesting pattern of your choice.
-
each vertex has the following attributes:
- mass
- current position
- current velocity
- accumulated force
- 'fixed' flag (set if this vertex is not allowed to move)
each spring has the following attributes:
- pointer to the two masses it attaches to
- spring constant
- damper constant
- rest length (length in original configuration, for example)
use following pseudo-code
for each mass, set force to gravity + wind field
for each spring, compute force and add to masses' force (one +f, one -f)
for each mass, if not fixed, compute acceleration from force and update velocity and position
Extra Credit:
- compare simulations:
- with and without diagonal springs
- with and without angular springs
- map a really interesting texture onto the cloth
- animate the fixed points to create interesting animation
- try clamping the length of a spring and/or the spring length velocity for more robust cloth