Assignment 5: Cloth simulation with gravity, wind, and collision detection
DATE DUE: May 24, 2017
Points possible: 25 points
CS-116B: Computer Graphics Algorithms
Instructor: Robert Bruce

OVERVIEW

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).

EXAMPLE

Here is an example video of what your cloth simulation should (roughly) look like. Note: you do NOT need to use checkerboard pattern on your cloth. You do NOT need to have the ball move in a circular motion. Per the specifications above, you choose the motion of the ball. Just make sure your ball collides with the cloth.

SUBMITTING YOUR PROGRAM

1. Please submit your program as a text file to the Canvas dropbox. I only need the source code. I will build the program myself.

2. Please name your program using the following naming convention:

Lastname_Firstname_final_assignment.c (for C programs)

Lastname_Firstname_final_assignment.cpp (for C++ programs)

3. Please include your name as a comment at the beginning of your program.

4. I usually do not need a makefile to build your programs, regardless of language; however, in the unlikely event that I cannot build your project, I will send an email inquiry as appropriate.

5. I expect your program to build without syntax errors.

6. I expect your program to execute without run-time errors.

GRADING

Points will be deducted for any program that does not meet the specification as outlined above.

LATE ASSIGNMENTS

Assignments submitted after the due date will be worth, at most, 12.5 points. Additional points will be deducted for programs not meeting the specification as outlined above.