![]() |
Skylicht Engine
|
Quaternion class for representing rotations. More...
#include <C:/Projects/skylicht-engine/Projects/Irrlicht/Include/quaternion.h>
Public Member Functions | |
| quaternion () | |
| Default Constructor. | |
| quaternion (f32 x, f32 y, f32 z, f32 w) | |
| Constructor. | |
| quaternion (f32 x, f32 y, f32 z) | |
| Constructor which converts euler angles (radians) to a quaternion. | |
| quaternion (const vector3df &vec) | |
| Constructor which converts euler angles (radians) to a quaternion. | |
| quaternion (const matrix4 &mat) | |
| Constructor which converts a matrix to a quaternion. | |
| bool | operator== (const quaternion &other) const |
| Equalilty operator. | |
| bool | operator!= (const quaternion &other) const |
| inequality operator | |
| quaternion & | operator= (const quaternion &other) |
| Assignment operator. | |
| quaternion & | operator= (const matrix4 &other) |
| Matrix assignment operator. | |
| quaternion | operator+ (const quaternion &other) const |
| Add operator. | |
| quaternion | operator* (const quaternion &other) const |
| Multiplication operator. | |
| quaternion | operator* (f32 s) const |
| Multiplication operator with scalar. | |
| quaternion & | operator*= (f32 s) |
| Multiplication operator with scalar. | |
| vector3df | operator* (const vector3df &v) const |
| Multiplication operator. | |
| quaternion & | operator*= (const quaternion &other) |
| Multiplication operator. | |
| f32 | dotProduct (const quaternion &other) const |
| Calculates the dot product. | |
| quaternion & | set (f32 x, f32 y, f32 z, f32 w) |
| Sets new quaternion. | |
| quaternion & | set (f32 x, f32 y, f32 z) |
| Sets new quaternion based on euler angles (radians). | |
| quaternion & | set (const core::vector3df &vec) |
| Sets new quaternion based on euler angles (radians). | |
| quaternion & | set (const core::quaternion &quat) |
| Sets new quaternion from other quaternion. | |
| bool | equals (const quaternion &other, const f32 tolerance=ROUNDING_ERROR_f32) const |
| returns if this quaternion equals the other one, taking floating point rounding errors into account | |
| quaternion & | normalize () |
| Normalizes the quaternion. | |
| matrix4 | getMatrix () const |
| Creates a matrix from this quaternion. | |
| void | getMatrix (matrix4 &dest, const core::vector3df &translation) const |
| Creates a matrix from this quaternion. | |
| void | getMatrix (matrix4 &dest) const |
| void | getMatrixCenter (matrix4 &dest, const core::vector3df ¢er, const core::vector3df &translation) const |
| void | getMatrix_transposed (matrix4 &dest) const |
| Creates a matrix from this quaternion. | |
| quaternion & | makeInverse () |
| Inverts this quaternion. | |
| quaternion & | lerp (quaternion q1, quaternion q2, f32 time) |
| Set this quaternion to the linear interpolation between two quaternions. | |
| quaternion & | slerp (quaternion q1, quaternion q2, f32 time, f32 threshold=.05f) |
| Set this quaternion to the result of the spherical interpolation between two quaternions. | |
| quaternion & | fromAngleAxis (f32 angle, const vector3df &axis) |
| Create quaternion from rotation angle and rotation axis. | |
| void | toAngleAxis (f32 &angle, core::vector3df &axis) const |
| Fills an angle (radians) around an axis (unit vector). | |
| void | toEuler (vector3df &euler) const |
| Output this quaternion to an euler angle (radians). | |
| quaternion & | makeIdentity () |
| Set quaternion to identity. | |
| quaternion & | rotationFromTo (const vector3df &from, const vector3df &to) |
| Set quaternion to represent a rotation from one vector to another. | |
Public Attributes | |
| f32 | X |
| Quaternion elements. | |
| f32 | Y |
| f32 | Z |
| f32 | W |
Quaternion class for representing rotations.
It provides cheap combinations and avoids gimbal locks. Also useful for interpolations.
|
inline |
Create quaternion from rotation angle and rotation axis.
axis must be unit length, angle in radians
Axis must be unit length. The quaternion representing the rotation is q = cos(A/2)+sin(A/2)*(x*i+y*j+z*k).
| angle | Rotation Angle in radians. |
| axis | Rotation axis. |
|
inline |
Creates a matrix from this quaternion
|
inline |
Creates a matrix from this quaternion Rotate about a center point shortcut for core::quaternion q; q.rotationFromTo ( vin[i].Normal, forward ); q.getMatrixCenter ( lookat, center, newPos );
core::matrix4 m2; m2.setInverseTranslation ( center ); lookat *= m2;
core::matrix4 m3; m2.setTranslation ( newPos ); lookat *= m3;
Creates a matrix from this quaternion Rotate about a center point shortcut for core::quaternion q; q.rotationFromTo(vin[i].Normal, forward); q.getMatrix(lookat, center);
core::matrix4 m2; m2.setInverseTranslation(center); lookat *= m2;
|
inline |
Set this quaternion to the linear interpolation between two quaternions.
| q1 | First quaternion to be interpolated. |
| q2 | Second quaternion to be interpolated. |
| time | Progress of interpolation. For time=0 the result is q1, for time=1 the result is q2. Otherwise interpolation between q1 and q2. |
|
inline |
Set this quaternion to the result of the spherical interpolation between two quaternions.
| q1 | First quaternion to be interpolated. |
| q2 | Second quaternion to be interpolated. |
| time | Progress of interpolation. For time=0 the result is q1, for time=1 the result is q2. Otherwise interpolation between q1 and q2. |
| threshold | To avoid inaccuracies at the end (time=1) the interpolation switches to linear interpolation at some point. This value defines how much of the remaining interpolation will be calculated with lerp. Everything from 1-threshold up will be linear interpolation. |