sgQuaternion Class Reference
#include <sgQuaternion.h>
List of all members.
Public Member Functions |
| sgQuaternion (const sgQuaternion &quat) |
| sgQuaternion (float x_=0.0f, float y_=0.0f, float z_=0.0f, float w_=1.0f) |
| sgQuaternion (const sgVector3 &rot) |
| sgQuaternion (const sgVector4 &rot) |
bool | operator== (sgQuaternion &other) |
bool | operator!= (sgQuaternion &other) |
sgQuaternion & | operator= (const sgQuaternion &other) |
sgQuaternion & | operator= (const sgVector3 &other) |
sgQuaternion & | operator= (const sgVector4 &other) |
sgQuaternion & | operator+= (const sgQuaternion &other) |
sgQuaternion & | operator-= (const sgQuaternion &other) |
sgQuaternion & | operator*= (const sgQuaternion &other) |
sgQuaternion & | operator/= (const sgQuaternion &other) |
sgQuaternion | operator+ (const sgQuaternion &other) |
sgQuaternion | operator- (const sgQuaternion &other) |
sgQuaternion | operator* (const sgQuaternion &other) |
sgQuaternion | operator/ (const sgQuaternion &other) |
sgQuaternion & | operator+= (const sgVector3 &other) |
sgQuaternion & | operator-= (const sgVector3 &other) |
sgQuaternion | operator+ (const sgVector3 &other) |
sgQuaternion | operator- (const sgVector3 &other) |
sgQuaternion & | operator*= (const float &other) |
sgQuaternion & | operator/= (const float &other) |
sgQuaternion | operator* (const float &other) |
sgQuaternion | operator/ (const float &other) |
void | makeIdentity () |
void | makeEuler (const sgVector3 &rot) |
void | makeEuler (const sgVector4 &rot) |
void | makeAxisAngle (const sgVector3 &axis, float ang) |
void | makeAxisAngle (const sgVector4 &axis) |
void | makeLerpS (const sgQuaternion &quat1, const sgQuaternion &quat2, float fac) |
void | makeLerpN (const sgQuaternion &quat1, const sgQuaternion &quat2, float fac) |
void | makeLerpS (const sgQuaternion &other, float fac) |
void | makeLerpN (const sgQuaternion &other, float fac) |
sgQuaternion | lerpS (sgQuaternion &other, float fac) |
sgQuaternion | lerpN (sgQuaternion &other, float fac) |
void | normalize () |
void | conjugate () |
float | length () |
float | dot (const sgQuaternion &other) |
sgVector3 | rotate (const sgVector3 &vec) |
sgVector4 | rotate (const sgVector4 &vec) |
sgMatrix4x4 | getMatrix () |
sgVector3 | getEuler () |
sgVector4 | getAxisAngle () |
Public Attributes |
float | x |
float | y |
float | z |
float | w |
Detailed Description
Quaternion class. Stores a quaternion and provides functionality for it. All angles are in degrees!
Constructor & Destructor Documentation
Constructor. Initializes a new instance from the other quaternion.
- Parameters:
-
| quat | the other quaternion to copy the values from |
sgQuaternion::sgQuaternion |
( |
float |
x_ = 0.0f , |
|
|
float |
y_ = 0.0f , |
|
|
float |
z_ = 0.0f , |
|
|
float |
w_ = 1.0f | |
|
) |
| | |
Constructor. Initializes a new instance from the given values.
- Parameters:
-
| x_ | the quaternions x value |
| y_ | the quaternions y value |
| z_ | the quaternions z value |
| w_ | the quaternions w value |
sgQuaternion::sgQuaternion |
( |
const sgVector3 & |
rot |
) |
|
Constructor. Initializes a new instance from the vector.
- Parameters:
-
| rot | the rotation as euler angles to initialize the quaternion with |
sgQuaternion::sgQuaternion |
( |
const sgVector4 & |
rot |
) |
|
Constructor. Initializes a new instance from the vector.
- Parameters:
-
| rot | the rotation in axis angle format to initialize the quaternion with |
Member Function Documentation
void sgQuaternion::conjugate |
( |
|
) |
|
Conjugate. Inverts the quaternions imaginary parts.
Dot product. The dot product of the quaternion with the other one.
- Parameters:
-
- Returns:
- the resulting scalar
Get axis angle. Returns the quaternions rotation in axis angle format.
- Returns:
- the rotation as axis and angle
Get euler. Returns the quaternions rotation as euler angles.
- Returns:
- the rotation as euler angles
Get matrix. Returns a rotation matrix representing the same rotation as the quaternion.
- Returns:
- the rotation matrix
float sgQuaternion::length |
( |
|
) |
|
Length. Get the length of the quaternion.
- Returns:
- the quaternions length
Linear interpolation. Interpolate linear between the instance and the first parameter.
- Parameters:
-
| other | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with, ranging from 0 to 1 |
- Returns:
- resulting quaternion from the interpolation
Spherical interpolation. Interpolate spherical between the instance and the first parameter.
- Parameters:
-
| other | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with, ranging from 0 to 1 |
- Returns:
- resulting quaternion from the interpolation
void sgQuaternion::makeAxisAngle |
( |
const sgVector4 & |
axis |
) |
|
Make axis angle. Set the quaternion to the representation of the given rotation around the given axis.
- Parameters:
-
| axis | vector containing the orientation of the axis to rotate around and the angle as fourth parameter |
void sgQuaternion::makeAxisAngle |
( |
const sgVector3 & |
axis, |
|
|
float |
ang | |
|
) |
| | |
Make axis angle. Set the quaternion to the representation of the given rotation around the given axis.
- Parameters:
-
| axis | vector containing the orientation of the axis to rotate around |
| ang | rotation angle in degrees |
void sgQuaternion::makeEuler |
( |
const sgVector4 & |
rot |
) |
|
Make euler. Set the quaternion to the representation of the given euler angles, by ignoring the vectors w component.
- Parameters:
-
| rot | vector containing the rotation as euler angles |
void sgQuaternion::makeEuler |
( |
const sgVector3 & |
rot |
) |
|
Make euler. Set the quaternion to the representation of the given euler angles.
- Parameters:
-
| rot | vector containing the rotation as euler angles |
void sgQuaternion::makeIdentity |
( |
|
) |
|
Make identity. Set the quaternion to the one representing no rotation.
void sgQuaternion::makeLerpN |
( |
const sgQuaternion & |
other, |
|
|
float |
fac | |
|
) |
| | |
Make linear interpolation. Set the quaternion to the result of the linear interpolation given by the instance and the parameters.
- Parameters:
-
| other | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with, ranging from 0 to 1 |
Make linear interpolation. Set the quaternion to the result of the linear interpolation given by the parameters.
- Parameters:
-
| quat1 | the first quaternion to interpolate from |
| quat2 | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with, ranging from 0 to 1 |
void sgQuaternion::makeLerpS |
( |
const sgQuaternion & |
other, |
|
|
float |
fac | |
|
) |
| | |
Make spherical interpolation. Set the quaternion to the result of the spherical interpolation given by the instance and the parameters.
- Parameters:
-
| other | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with, ranging from 0 to 1 |
Make spherical interpolation. Set the quaternion to the result of the spherical interpolation given by the parameters.
- Parameters:
-
| quat1 | the first quaternion to interpolate from |
| quat2 | the second quaternion to interpolate from |
| fac | the interpolation factor to interpolate with ranging from 0 to 1 |
void sgQuaternion::normalize |
( |
|
) |
|
Normalize. Normalizes the quaternion.
Not equal. Checks if two instances do not equal each other.
sgQuaternion sgQuaternion::operator* |
( |
const float & |
other |
) |
|
Multiply. Multiply the quaternions with a scalar.
Multiply. Multiply the two quaternions.
sgQuaternion & sgQuaternion::operator*= |
( |
const float & |
other |
) |
|
Multiply. Multiply the quaternions with a scalar.
Multiply. Multiply the two quaternions.
Add. Add the euler angles in the vector to the rotation of the quaternion.
Add. Add the two quaternions.
Add. Add the euler angles in the vector to the rotation of the quaternion.
Add. Add the two quaternions.
Substract. Substract the euler angles in the vector from the rotation of the quaternion.
Substract. Substract the two quaternions.
Substract. Substract the euler angles in the vector from the rotation of the quaternion.
Substract. Substract the two quaternions.
sgQuaternion sgQuaternion::operator/ |
( |
const float & |
other |
) |
|
Divide. Divide the quaternions by a scalar.
Divide. Divide the two quaternions.
sgQuaternion & sgQuaternion::operator/= |
( |
const float & |
other |
) |
|
Divide. Divide the quaternions by a scalar.
Divide. Divide the two quaternions.
Copy. Set the quaternion to the representation of the axis and angle given by the parameter.
Copy. Set the quaternion to the representation of the euler angles given by the parameter.
Copy. Copy the values of one instance to the other.
Equal. Checks if two instances equal each other.
Rotate vector. Applies the rotation represented by the quaternion to a vector.
- Parameters:
-
- Returns:
- the rotated vector
Rotate vector. Applies the rotation represented by the quaternion to a vector.
- Parameters:
-
- Returns:
- the rotated vector
Member Data Documentation
W. The quaternions w component. The real part.
X. The quaternions x component.
Y. The quaternions y component.
Z. The quaternions z component.
The documentation for this class was generated from the following files:
- iSDGE/Engine/Common/sgQuaternion.h
- iSDGE/Engine/Common/sgQuaternion.mm