CS91 Computer Animation: Lab 2

In which, we begin working with quaternions
This assignment will complete the core rotation utilities in our animation framework. You will implement conversion routines between quaternions and matrices. After completing this asisgnment, all your teapots will spin in unison.

Step 1: Get the source

This assignment will use the same basecode as the previous week.

Step 2: Compile and run

Compiling and running is the same as our last lab.

Same as last week, the assignment demo shows teapots in a 3 by 3 grid. Each teapot tests a conversion function. This week, we will complete the demo with quaternion conversions.

> ../bin/Rotations
The executable should pop up an openGL window the looks something like the following

Assignment 2: Due Feb 13

Unit quaternions are a robust and compact way of representing rotations. In this assignment, you will implement conversions between quaternions and matrices. The basecode includes classes for 3x3 rotation matrices, defined as mat3 (located in libsrc\animation\aRotation.*) as well as Quaternions Quaternion (also located in libsrc\animation\aRotation.*)
  1. (10 points) Convert from 3x3 matrix to quaternion, Quaternion::FromRotation()
  2. (10 points) Convert from a quaternion to a 3x3 matrix, Quaternion::ToRotation()
  3. (10 points) Convert from a quaternion to angle axis, Quaternion::ToAngleAxis()
  4. (10 points) Convert from angle axis to a quaternion, Quaternion::FromAngleAxis()

Extra challenges:

These are optional assignment questions for those of you who want to take their assignments to the next level. Have your own idea you want to explore? Let the me know!
  1. Animate the colors of the teapot to change with the rotation. For example, if the euler angle is (50,75,100), convert it to a color (50/360, 75/360, 100/360). Develop a color mapping which you think looks cool, or helps visualize what's going on.
  2. Draw the local axes of the teapot. Use a red line to represent the X axis; a green line to represent the Y axis; and a blue line to represent the Z axis.
  3. Using Euler angles, demonstrate an example of gimbol lock and include it in your video.
  4. What happens if the transformation order is changed in drawDemo1()? Change the transformation order and see what happens!

Submission Guidelines

Submitting your assignment

Students should submit their code along with a README and videos. The README can be very brief, consisting of Videos should show results, including any extra challenges. Videos will be collected together and shown during class presentations. Please submit a mp4 of length no more than 60 seconds. For example

About checkins

You will be asked to briefly checkin (less than 1 minute) about your homework assignment. This is not intended to much work. Please don't prepare slides or a voice over for your video. None of these are necessary! Some ideas of what you might like to talk about: