BSNS102 Study Guide - Final Guide: Euler Angles, Row And Column Vectors, Identity Matrix
Document Summary
// implement a simple 3 3 matrix that is used for rotation only. // is specified at the time of transformation. class rotationmatrix { public: // the details of the layout float m11, m12, m13; float m21, m22, m23; float m31, m32, m33; // setup the matrix with a specified orientation void setup(const eulerangles &orientation); // setup the matrix from a quaternion, assuming the. // specified direction of transformation void void frominertialtoobjectquaternion(const quaternion &q); fromobjecttoinertialquaternion(const quaternion &q); Vector3 inertialtoobject(const vector3 &v) const; objecttoinertial(const vector3 &v) const; Because of its tight focus, class rotationmatrix is extremely easy to use. First, we set up the matrix using euler angles or a quaternion. If we are using a quaternion, then we must specify which sort of angular displacement the quaternion represents. Once we have created the matrix, we perform rotations using the inertialtoobject() and objecttoinertial() functions. The implementation for class rotationmatrix is in rotationmatrix. cpp. // 3d math primer for graphics and game development.