Homework Structure
The homework has 5 parts worth a total of 100 possible points. Some require only a few lines of code, while others are more substantial.
You will also need to reference our Deliverables, specifically to review our write-up rubric.
Getting Started
As in Assignment 1, you should accept this assignment from GitHub Classroom, and clone the generated repo (not the class skeleton). Make sure you enable GitHub Pages for your write-up assignment. You can reuse the same GitHub repository from Homework 1, in fact, that’s recommended!
$ git clone <YOUR_PRIVATE_REPO>
Please consult the article that discusses how to build assignments for more information on how to setup and build the assignment.
After you have built the program, you will have an executable file clothsim
that takes in zero or one argument. Running the program with zero arguments will load up the default scene. Otherwise, to load a specific scene, run the program as follows:
./clothsim -f ../scene/<my_scene>.json
You will also need to use the -o
and -a
flags for the write-up, which control the resolution of the rendered spheres. -o <INT>
controls the vertical resolution, and -a <INT>
controls the horizontal resolution. For example, this will render a particularly high-quality sphere:
./clothsim -f ../scene/sphere.json -o 128 -a 128
Getting acquainted with the starter code
Before you start, here is some basic information on the structure of the starter code.
- cloth.cpp/h: The cloth representation, as well as methods that directly change the cloth during the simulation
- clothSimulator.cpp/h: The primary program that wraps around the cloth and its constituents and runs the simulation and GUI
- spring.h: A struct definition for a simple spring in our mass-spring system that represents a connection between two point masses
- pointMass.h: A struct definition for a single point mass that discretizes the cloth and is affected by forces (e.g. spring forces, gravity) in the system
- collision/: Directory containing struct definitions for static primitive objects, such as sphere.cpp/h and plane.cpp/h
- scene/: Directory containing various scenes saved in JSON format
In this homework, you will write code in cloth.cpp, collision/sphere.cpp, and collision/plane.cpp.
Using the GUI
Besides the actual graphical user interface that you can work with using your mouse to tweak cloth parameters and dynamically change external forces, there are several keyboard commands that you might find useful.
Command | Key |
---|---|
Pause simulation | P |
(while paused) Go forward 1 timestep | N |
Restart simulation | R |
End simulation | ESC |
Reset camera to default position | SPACE |
Rotate camera | (click and drag, or right click) |
Pan camera | (hold control + click and drag, or right click) |
Write-Up
We recommend working on your write-up for the assignment as you go. Reference our website tips and advice section for information on best practices.
For each part, we’ll include the relevant write-up desired, which is pulled directly from our Homework 4 Deliverables page. When performing your final checks, please compare against the Deliverables page for the full rubric.
As a reminder, you are primarily graded on your write-up submission. Having a public website is a requirement, and can serve as a portfolio for you to show off your amazing graphics work in future years, but will not be utilized while grading, so please make sure to check that your PDF catches all images and updates that you’ve made to your website.