The Quaternion class inherits from the Tuple class, specilizing the templated parameter to float for element type. More...
#include <quaternion.h>
Public Member Functions | |
| Quaternion () | |
| Constructs a Quaternion object, all elements initialized to 0. | |
| Quaternion (const Quaternion &other) | |
| Quaternion (float x, float y, float z, float w) | |
| Quaternion (const Vector3f &axis, float angle) | |
| Constructs a Quaternion object using the rotating axis and rotating angle. | |
| const float & | operator[] (int index) const |
| Provides read-only access to the element at a specific index(position) within the Quaternion object. | |
| float & | operator[] (int index) |
| Provides read-write access to the element at a specific index(position) within the Quaternion object. | |
| const float & | operator[] (char key) const |
| Provides read-only access to a element within the Quaternion object using a character key. | |
| float & | operator[] (char key) |
| Provides read-write access to a element within the Quaternion object using a character key. | |
| Quaternion | operator- () const |
| Returns a Quaternion object that is formed by changing the sign of each element of the current quaternion. | |
| void | set (float x, float y, float z, float w) |
| Sets the elements of the Quaternion object. | |
| void | set (const Vector3f &axis, float angle) |
| Sets the elements of the Quaternion object using the rotating axis and rotating angle. | |
| bool | normalize () |
| Normalize the current Quaternion object and returns a boolean value indicating success. | |
Public Member Functions inherited from cil::Tuple< float > | |
| Tuple (int size) | |
| Constructs a Tuple object with a specified number of elements, and initialize all elements to 0. | |
| virtual | ~Tuple () |
| int | size () const |
| Gets the number of elements of the Tuple. | |
| float * | data () |
| Gets the data array of the Tuple. | |
| const float * | data () const |
| Gets the data array of the Tuple, and the data could not be modified upon which this function is called. | |
| void | setData (const float *data) |
| Sets the data array of the Variant. | |
| Tuple< float > & | operator= (const Tuple &other) |
| Copys the data of another Tuple to the one on which the operator is invoked. | |
| bool | operator== (const Tuple &other) const |
| Compares the Tuple with another one, and returns true if they are equal, otherwise returns false. | |
| bool | operator!= (const Tuple &other) const |
| Compares the Tuple with another one, and returns false if they are equal, otherwise returns true. | |
Public Member Functions inherited from cil::Variant | |
| Variant () | |
| virtual | ~Variant () |
| const std::string & | type () const |
Additional Inherited Members | |
Protected Attributes inherited from cil::Tuple< float > | |
| float * | m_data |
| The data array of the Tuple. | |
| int | m_size |
| The number of elements that the data array of the Tuple holds. | |
Protected Attributes inherited from cil::Variant | |
| std::string | m_type |
The Quaternion class inherits from the Tuple class, specilizing the templated parameter to float for element type.
The Quaternion object stores four elements (x, y, z, w), where (x, y, z) represents the rotating axis, and w represents the radian of rotation.
| cil::Quaternion::Quaternion | ( | ) |
Constructs a Quaternion object, all elements initialized to 0.
| cil::Quaternion::Quaternion | ( | const Quaternion & | other | ) |
| cil::Quaternion::Quaternion | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | w ) |
| cil::Quaternion::Quaternion | ( | const Vector3f & | axis, |
| float | angle ) |
Constructs a Quaternion object using the rotating axis and rotating angle.
The rotating axis (x, y, z) and rotating angle theta is converted to the Quaternion (x * sin(theta/2), y * sin(theta/2), z * sin(theta/2), cos(theta/2)).
| bool cil::Quaternion::normalize | ( | ) |
Normalize the current Quaternion object and returns a boolean value indicating success.
| Quaternion cil::Quaternion::operator- | ( | ) | const |
Returns a Quaternion object that is formed by changing the sign of each element of the current quaternion.
| float & cil::Quaternion::operator[] | ( | char | key | ) |
Provides read-write access to a element within the Quaternion object using a character key.
It allows accessing elements of the Color using character keys 'x', 'y', 'z', 'w'. If the key-check fails, returns the first element.
| const float & cil::Quaternion::operator[] | ( | char | key | ) | const |
Provides read-only access to a element within the Quaternion object using a character key.
It allows accessing elements of the Color using character keys 'x', 'y', 'z', 'w'. If the key-check fails, returns the first element.
| float & cil::Quaternion::operator[] | ( | int | index | ) |
Provides read-write access to the element at a specific index(position) within the Quaternion object.
| const float & cil::Quaternion::operator[] | ( | int | index | ) | const |
Provides read-only access to the element at a specific index(position) within the Quaternion object.
| void cil::Quaternion::set | ( | const Vector3f & | axis, |
| float | angle ) |
Sets the elements of the Quaternion object using the rotating axis and rotating angle.
The rotating axis (x, y, z) and rotating angle theta is converted to the Quaternion (x * sin(theta/2), y * sin(theta/2), z * sin(theta/2), cos(theta/2)).
| void cil::Quaternion::set | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | w ) |
Sets the elements of the Quaternion object.