Department of Computer Science
Worcester Polytechnic Institute

CS-4732: Computer Animation
Project 1: Follow My Spline!!
Due: Monday, March 25, 2013 at 11:59pm

Objective: In this project, you will read in a spline definition from a file, and move an object along the spline. You will move the object using both interpolating and approximating splines defined by the same control points. In addition, you will interpolate rotations represented with quaternions using SLERPing.

This project must be done individually.


Preparation: The aim of this preparation part is for you to be able to read in a list of spline control points for use in your animation. The file has a description of the structure in comments at the top. Your prep code should read in the values according to the description, and store them in an appropriate data structure/class. Your code should be able to skip comment lines (starting with a '#' character) and blank lines. Values on the other lines are comma-separated. Some are integers and some are floats.

It is important to be able to read such files for defining things in future animations you make for this course (and beyond) without the need to re-compile your code to use a different spline.

You are free to use either OpenGL or Java3D for this project.

Prep Coding:
  1. You should write code to read in a spline definition file like this one, and store the spline definition in a class (maybe called "Spline"?).
  2. Add a method to your class that prints the spline definition to the screen so you can check that you've read things in correctly.
  3. Compile and run the program!!

New Stuff: The aim of this part is to get you to move an object along the spline you read from the file. You can construct any object you like, but at a minimum you should use a cube with each face of a different color. No spheres! :-)

  • You should have your object start out at the first segment of the spline, and move through each segment defined by the control points. You need to implement an interpolating spline (Catmull-Rom Spline) and an approximating spline (Uniform B-Spline), based on the same input file. So, your animation should run twice, once with the Catmull-Rom Spline and once for the Uniform B-Spline.

    You may want to also display spheres at the control-point locations, so you can see how the points influence the movement.

  • In addition to the movement code, you should also implement SLERP of the rotations using quaternions. Since each control point consists of a position (X, Y, Z) and an orientation defined by Euler angles (XRot, YRot, ZRot), you should read in the angles, convert them to a quaternion, and apply that quaternion at the control point. Smoothly changing from one orientation to another is where the SLERP code comes in. So, you will need code to convert from Euler angles to quaternions, and code to SLERP between two quaternions.

Attacking the Problem: A good way to approach this project is to divide each of the parts into separate steps, since they are each relatively independent. For example, get the prep-code working first. Then add code to draw each of the control points as a small cube. Add code to draw your object (larger cube with each face a different color) at the origin. Then start working on adding code for the splines, first the Catmull-Rom Spline code, then the Uniform B-Spline code.

You will need to re-re-re-read the material from the book to really understand how splines work, and how to code them. The spline defined in the sample input file does a very simple movement, but you are free to define even simpler movement to test how well your spline code is working.

Next add the Euler-to-Quaternion code, and then the SLERP code. Again, choose simple rotations in your input file, and see how things are going. All the quaternion code for computing and displaying them should be able to be tested independently of the spline code, so don't feel you have to implement them in any particular order. One way to test your Euler-to-Quaternion code is to write a Quaternion-to-Euler method, and use it to reverse what you the other method did, and see if you come up with the same Euler angles.


Documentation: You must create adequate documentation, both internal and external, along with your project. The best way to produce internal documentation is by including inline comments. The preferred way to do this is to write the comments as you code. Get in the habit of writing comments as you type in your code. A good rule of thumb is that all code that does something non-trivial should have comments describing what you are doing. This is as much for others who might have to maintain your code, as for you (imagine you have to go back and maintain code you have not looked at for six months -- this WILL happen to you in the future!).

Create a README file containing all information you would like the TA to know when grading your work.

I use these file and function (method) headers, in my code. Please adopt these (or some other consistent convention) for all your projects. The file header should be used for both ".h" and ".cpp/.java" files.

Create external documentation for your program and submit it along with the project. The documentation does not have to be unnecessarily long, but should explain briefly what each part of your program does, and how your filenames tie in. Most importantly, tell the TA how to compile and run your program.

Create a YouTube video of your work, upload it, and submit the URL along with your documentation.


What to
Turn in:
Submit everything you need to compile and run your program (source files, data files, etc.)

BEFORE YOU SUBMIT YOUR PROJECT, put everything in one directory, compile it, and make sure it runs.

When you are ready to submit, zip everything up into a single archive file. Name the file LastName_FirstName_proj1.zip.

You will use the Web-based "Turnin" facility to submit your work. Information about submitting can be found here:

https://turnin.cs.wpi.edu/.

Use your WPI user ID to login, and you should have been emailed a password.
The Turnin assignment ID is proj1.


Academic
Honesty:
Remember the official WPI statements on Academic Honesty. You may discuss the project with others, but you are to do your own work.

Videos from
Previous Years:
D Term, 2013


Back to course page.