CPSC310A
Video Game Development

Activity 16

Quaternions

Details

Write a Quaternion class with the following methods:

  1. Quaternion(float x, float y, float z, float w)

    Creates a new Quaternion with the specified values.

  2. Quaternion(Vector axis, float angle)

    Creates a new Quaternion equivalent to the specified axis/angle rotation.

and add the following method to the Matrix class:

  1. Matrix rotate(Quaternion q)

    Returns a rotation matrix equivalent to the specified quaternion.

Submission

Please show your source code and run your program for the instructor.