Programming assignment 5: Cloth simulation with gravity, wind, and collision detection
CS-116B: Computer Graphics Algorithms
Instructor: Robert Bruce

Objective

For this assignment, you will add collision detection to the cloth simulator you wrote in assignment 4. Your cloth simulator will be subject to forces of gravity and wind. Your cloth simulator will also be subject to a sphere moving within its path.

Specifications

Your program should use a minimum of 50 particles horizontal by 50 particles vertical.

There is no maximum number of particles in the horizontal or vertical direction. Experiment and use more if you'd like!

The particles should be evenly spaced horizontally and vertically.

Both ends of your cloth should be immobile. This means at least three particles at either end of your cloth should not be subject to forces of gravity or spring forces.

You may choose the width and length of the cloth as long as (1) the cloth length is entirely visible on the screen and (2) there is some visible spacing between the particles.

Before your simulation begins, your cloth should look like a rectangule (or square if you made width and height the same).

You may use any color you like (as long as it is visible) for your cloth. You may use a solid color or a two-color checkerboard, horizontal, or vertical stripe pattern.

You may use any color you like for the color of the ball as long as the ball is visible and contrasts well with the cloth color or pattern.

The particles are the exact same mass (you can choose the value).

The invisible springs that connect each particle are weightless. You do not need to include the weight of the spring in your calculations.

The particles are subject to wind, gravity, and collision forces from a moving ball. Choose a value for the gravitational constant. It does NOT need to be 9.8 m/s2 as your constant for gravity because that might be too much gravitatational pull. Experiment with different values.

You may define the direction and magnitude of the wind force applied to the cloth. The cloth must sway in the wind or you will lose points!

You may define the direction of the moving ball as long as the ball collides with the cloth. The cloth must flow around the ball (not through it).