Defines a 4-element quaternion that represents the orientation of an object in space. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion () | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion () | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion (float xx, float yy, float zz, float ww) | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion ( var xx, var yy, var zz, var ww) | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion ( local xx, local yy, local zz, local ww) | |
Constructs a quaternion initialized to (0, 0, 0, 1). More... | |
Quaternion (float *array) | |
Constructs a new quaternion from the values in the specified array. More... | |
Quaternion (const Mat4 &m) | |
Constructs a quaternion equal to the rotational part of the specified matrix. More... | |
Quaternion (const Vec3 &axis, float angle) | |
Constructs a quaternion equal to the rotation from the specified axis and angle. More... | |
Quaternion (const Quaternion ©) | |
Constructs a new quaternion that is a copy of the specified one. More... | |
~Quaternion () | |
Destructor. More... | |
bool | isIdentity () const |
Determines if this quaternion is equal to the identity quaternion. More... | |
var | isIdentity () |
Determines if this quaternion is equal to the identity quaternion. More... | |
local | isIdentity () |
Determines if this quaternion is equal to the identity quaternion. More... | |
bool | isZero () const |
Determines if this quaternion is all zeros. More... | |
void | conjugate () |
Sets this quaternion to the conjugate of itself. More... | |
var | conjugate () |
Sets this quaternion to the conjugate of itself. More... | |
local | conjugate () |
Sets this quaternion to the conjugate of itself. More... | |
Quaternion | getConjugated () const |
Gets the conjugate of this quaternion in dst. More... | |
local | getConjugated () |
Gets the conjugate of this quaternion in dst. More... | |
bool | inverse () |
Sets this quaternion to the inverse of itself. More... | |
var | inverse () |
Sets this quaternion to the inverse of itself. More... | |
local | inverse () |
Sets this quaternion to the inverse of itself. More... | |
Quaternion | getInversed () const |
Gets the inverse of this quaternion in dst. More... | |
void | multiply (const Quaternion &q) |
Multiplies this quaternion by the specified one and stores the result in this quaternion. More... | |
void | normalize () |
Normalizes this quaternion to have unit length. More... | |
Quaternion | getNormalized () const |
Normalizes this quaternion and stores the result in dst. More... | |
void | set (float xx, float yy, float zz, float ww) |
Sets the elements of the quaternion to the specified values. More... | |
var | set ( var xx, var yy, var zz, var ww) |
Sets the elements of the quaternion to the specified values. More... | |
local | set ( local xx, local yy, local zz, local ww) |
Sets the elements of the quaternion to the specified values. More... | |
void | set (float *array) |
Sets the elements of the quaternion from the values in the specified array. More... | |
void | set (const Mat4 &m) |
Sets the quaternion equal to the rotational part of the specified matrix. More... | |
void | set (const Vec3 &axis, float angle) |
Sets the quaternion equal to the rotation from the specified axis and angle. More... | |
var | set ( var axis, var angle) |
Sets the quaternion equal to the rotation from the specified axis and angle. More... | |
local | set ( local axis, local angle) |
Sets the quaternion equal to the rotation from the specified axis and angle. More... | |
void | set (const Quaternion &q) |
Sets the elements of this quaternion to a copy of the specified quaternion. More... | |
void | setIdentity () |
Sets this quaternion to be equal to the identity quaternion. More... | |
float | toAxisAngle (Vec3 *e) const |
Converts this Quaternion4f to axis-angle notation. More... | |
var | toAxisAngle ( var e) |
Converts this Quaternion4f to axis-angle notation. More... | |
local | toAxisAngle ( local e) |
Converts this Quaternion4f to axis-angle notation. More... | |
const Quaternion | operator* (const Quaternion &q) const |
Calculates the quaternion product of this quaternion with the given quaternion. More... | |
Quaternion & | operator*= (const Quaternion &q) |
Multiplies this quaternion with the given quaternion. More... | |
Static Public Member Functions | |
static const Quaternion & | identity () |
Returns the identity quaternion. More... | |
local | identity () |
Returns the identity quaternion. More... | |
static const Quaternion & | zero () |
Returns the quaternion with all zeros. More... | |
local | zero () |
Returns the quaternion with all zeros. More... | |
static void | createFromRotationMatrix (const Mat4 &m, Quaternion *dst) |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst. More... | |
var | createFromRotationMatrix ( var m, var dst) |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst. More... | |
local | createFromRotationMatrix ( local m, local dst) |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst. More... | |
static void | createFromAxisAngle (const Vec3 &axis, float angle, Quaternion *dst) |
Creates this quaternion equal to the rotation from the specified axis and angle and stores the result in dst. More... | |
local | createFromAxisAngle ( local axis, local angle, local dst) |
Creates this quaternion equal to the rotation from the specified axis and angle and stores the result in dst. More... | |
static void | multiply (const Quaternion &q1, const Quaternion &q2, Quaternion *dst) |
Multiplies the specified quaternions and stores the result in dst. More... | |
static void | lerp (const Quaternion &q1, const Quaternion &q2, float t, Quaternion *dst) |
Interpolates between two quaternions using linear interpolation. More... | |
local | lerp ( local q1, local q2, local t, local dst) |
Interpolates between two quaternions using linear interpolation. More... | |
static void | slerp (const Quaternion &q1, const Quaternion &q2, float t, Quaternion *dst) |
Interpolates between two quaternions using spherical linear interpolation. More... | |
local | slerp ( local q1, local q2, local t, local dst) |
Interpolates between two quaternions using spherical linear interpolation. More... | |
static void | squad (const Quaternion &q1, const Quaternion &q2, const Quaternion &s1, const Quaternion &s2, float t, Quaternion *dst) |
Interpolates over a series of quaternions using spherical spline interpolation. More... | |
local | squad ( local q1, local q2, local s1, local s2, local t, local dst) |
Interpolates over a series of quaternions using spherical spline interpolation. More... | |
Public Attributes | |
float | x |
The x-value of the quaternion's vector component. More... | |
var | x |
The x-value of the quaternion's vector component. More... | |
local | x |
The x-value of the quaternion's vector component. More... | |
float | y |
The y-value of the quaternion's vector component. More... | |
var | y |
The y-value of the quaternion's vector component. More... | |
local | y |
The y-value of the quaternion's vector component. More... | |
float | z |
The z-value of the quaternion's vector component. More... | |
var | z |
The z-value of the quaternion's vector component. More... | |
local | z |
The z-value of the quaternion's vector component. More... | |
float | w |
The scalar component of the quaternion. More... | |
var | w |
The scalar component of the quaternion. More... | |
local | w |
The scalar component of the quaternion. More... | |
Static Public Attributes | |
static const Quaternion | ZERO |
equals to Quaternion(0,0,0, 0) More... | |
Friends | |
class | Curve |
class | Transform |
Defines a 4-element quaternion that represents the orientation of an object in space.
Quaternions are typically used as a replacement for euler angles and rotation matrices as a way to achieve smooth interpolation and avoid gimbal lock.
Note that this quaternion class does not automatically keep the quaternion normalized. Therefore, care must be taken to normalize the quaternion when necessary, by calling the normalize method. This class provides three methods for doing quaternion interpolation: lerp, slerp, and squad.
lerp (linear interpolation): the interpolation curve gives a straight line in quaternion space. It is simple and fast to compute. The only problem is that it does not provide constant angular velocity. Note that a constant velocity is not necessarily a requirement for a curve; slerp (spherical linear interpolation): the interpolation curve forms a great arc on the quaternion unit sphere. Slerp provides constant angular velocity; squad (spherical spline interpolation): interpolating between a series of rotations using slerp leads to the following problems:
Since squad is continuously differentiable, it remedies the first and third problems mentioned above. The slerp method provided here is intended for interpolation of principal rotations. It treats +q and -q as the same principal rotation and is at liberty to use the negative of either input. The resulting path is always the shorter arc.
The lerp method provided here interpolates strictly in quaternion space. Note that the resulting path may pass through the origin if interpolating between a quaternion and its exact negative.
As an example, consider the following quaternions:
q1 = (0.6, 0.8, 0.0, 0.0), q2 = (0.0, 0.6, 0.8, 0.0), q3 = (0.6, 0.0, 0.8, 0.0), and q4 = (-0.8, 0.0, -0.6, 0.0). For the point p = (1.0, 1.0, 1.0), the following figures show the trajectories of p using lerp, slerp, and squad.
Quaternion | ( | ) |
Constructs a quaternion initialized to (0, 0, 0, 1).
var Quaternion | ( | ) |
Constructs a quaternion initialized to (0, 0, 0, 1).
local Quaternion | ( | ) |
Constructs a quaternion initialized to (0, 0, 0, 1).
Quaternion | ( | float | xx, |
float | yy, | ||
float | zz, | ||
float | ww | ||
) |
Constructs a quaternion initialized to (0, 0, 0, 1).
xx | The x component of the quaternion. |
yy | The y component of the quaternion. |
zz | The z component of the quaternion. |
ww | The w component of the quaternion. |
var Quaternion | ( | var | xx, |
var | yy, | ||
var | zz, | ||
var | ww | ||
) |
Constructs a quaternion initialized to (0, 0, 0, 1).
xx | The x component of the quaternion. |
yy | The y component of the quaternion. |
zz | The z component of the quaternion. |
ww | The w component of the quaternion. |
local Quaternion | ( | local | xx, |
local | yy, | ||
local | zz, | ||
local | ww | ||
) |
Constructs a quaternion initialized to (0, 0, 0, 1).
xx | The x component of the quaternion. |
yy | The y component of the quaternion. |
zz | The z component of the quaternion. |
ww | The w component of the quaternion. |
Quaternion | ( | float * | array | ) |
Constructs a new quaternion from the values in the specified array.
array | The values for the new quaternion. |
var Quaternion | ( | var | array | ) |
Constructs a new quaternion from the values in the specified array.
array | The values for the new quaternion. |
local Quaternion | ( | local | array | ) |
Constructs a new quaternion from the values in the specified array.
array | The values for the new quaternion. |
Quaternion | ( | const Mat4 & | m | ) |
Constructs a quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
var Quaternion | ( | var | m | ) |
Constructs a quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
local Quaternion | ( | local | m | ) |
Constructs a quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
Quaternion | ( | const Vec3 & | axis, |
float | angle | ||
) |
Constructs a quaternion equal to the rotation from the specified axis and angle.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
var Quaternion | ( | var | axis, |
var | angle | ||
) |
Constructs a quaternion equal to the rotation from the specified axis and angle.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
local Quaternion | ( | local | axis, |
local | angle | ||
) |
Constructs a quaternion equal to the rotation from the specified axis and angle.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
Quaternion | ( | const Quaternion & | copy | ) |
Constructs a new quaternion that is a copy of the specified one.
copy | The quaternion to copy. |
var Quaternion | ( | var | copy | ) |
Constructs a new quaternion that is a copy of the specified one.
copy | The quaternion to copy. |
local Quaternion | ( | local | copy | ) |
Constructs a new quaternion that is a copy of the specified one.
copy | The quaternion to copy. |
~Quaternion | ( | ) |
Destructor.
var ~Quaternion | ( | ) |
Destructor.
local ~Quaternion | ( | ) |
Destructor.
void conjugate | ( | ) |
Sets this quaternion to the conjugate of itself.
var conjugate | ( | ) |
Sets this quaternion to the conjugate of itself.
local conjugate | ( | ) |
Sets this quaternion to the conjugate of itself.
|
static |
Creates this quaternion equal to the rotation from the specified axis and angle and stores the result in dst.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
dst | A quaternion to store the conjugate in. |
|
static |
Creates this quaternion equal to the rotation from the specified axis and angle and stores the result in dst.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
dst | A quaternion to store the conjugate in. |
|
static |
Creates this quaternion equal to the rotation from the specified axis and angle and stores the result in dst.
axis | A vector describing the axis of rotation. |
angle | The angle of rotation (in radians). |
dst | A quaternion to store the conjugate in. |
|
static |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst.
m | The matrix. |
dst | A quaternion to store the conjugate in. |
|
static |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst.
m | The matrix. |
dst | A quaternion to store the conjugate in. |
|
static |
Creates a quaternion equal to the rotational part of the specified matrix and stores the result in dst.
m | The matrix. |
dst | A quaternion to store the conjugate in. |
Quaternion getConjugated | ( | ) | const |
Gets the conjugate of this quaternion in dst.
dst | A quaternion to store the conjugate in. |
var getConjugated | ( | ) |
Gets the conjugate of this quaternion in dst.
dst | A quaternion to store the conjugate in. |
local getConjugated | ( | ) |
Gets the conjugate of this quaternion in dst.
dst | A quaternion to store the conjugate in. |
Quaternion getInversed | ( | ) | const |
Gets the inverse of this quaternion in dst.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
dst | A quaternion to store the inverse in. |
var getInversed | ( | ) |
Gets the inverse of this quaternion in dst.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
dst | A quaternion to store the inverse in. |
local getInversed | ( | ) |
Gets the inverse of this quaternion in dst.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
dst | A quaternion to store the inverse in. |
Quaternion getNormalized | ( | ) | const |
Normalizes this quaternion and stores the result in dst.
If the quaternion already has unit length or if the length of the quaternion is zero, this method simply copies this vector into dst.
dst | A quaternion to store the result in. |
var getNormalized | ( | ) |
Normalizes this quaternion and stores the result in dst.
If the quaternion already has unit length or if the length of the quaternion is zero, this method simply copies this vector into dst.
dst | A quaternion to store the result in. |
local getNormalized | ( | ) |
Normalizes this quaternion and stores the result in dst.
If the quaternion already has unit length or if the length of the quaternion is zero, this method simply copies this vector into dst.
dst | A quaternion to store the result in. |
|
static |
Returns the identity quaternion.
|
static |
Returns the identity quaternion.
|
static |
Returns the identity quaternion.
bool inverse | ( | ) |
Sets this quaternion to the inverse of itself.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
var inverse | ( | ) |
Sets this quaternion to the inverse of itself.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
local inverse | ( | ) |
Sets this quaternion to the inverse of itself.
Note that the inverse of a quaternion is equal to its conjugate when the quaternion is unit-length. For this reason, it is more efficient to use the conjugate method directly when you know your quaternion is already unit-length.
bool isIdentity | ( | ) | const |
Determines if this quaternion is equal to the identity quaternion.
var isIdentity | ( | ) |
Determines if this quaternion is equal to the identity quaternion.
local isIdentity | ( | ) |
Determines if this quaternion is equal to the identity quaternion.
bool isZero | ( | ) | const |
Determines if this quaternion is all zeros.
var isZero | ( | ) |
Determines if this quaternion is all zeros.
local isZero | ( | ) |
Determines if this quaternion is all zeros.
|
static |
Interpolates between two quaternions using linear interpolation.
The interpolation curve for linear interpolation between quaternions gives a straight line in quaternion space.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates between two quaternions using linear interpolation.
The interpolation curve for linear interpolation between quaternions gives a straight line in quaternion space.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates between two quaternions using linear interpolation.
The interpolation curve for linear interpolation between quaternions gives a straight line in quaternion space.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
void multiply | ( | const Quaternion & | q | ) |
Multiplies this quaternion by the specified one and stores the result in this quaternion.
q | The quaternion to multiply. |
var multiply | ( | var | q | ) |
Multiplies this quaternion by the specified one and stores the result in this quaternion.
q | The quaternion to multiply. |
local multiply | ( | local | q | ) |
Multiplies this quaternion by the specified one and stores the result in this quaternion.
q | The quaternion to multiply. |
|
static |
Multiplies the specified quaternions and stores the result in dst.
q1 | The first quaternion. |
q2 | The second quaternion. |
dst | A quaternion to store the result in. |
|
static |
Multiplies the specified quaternions and stores the result in dst.
q1 | The first quaternion. |
q2 | The second quaternion. |
dst | A quaternion to store the result in. |
|
static |
Multiplies the specified quaternions and stores the result in dst.
q1 | The first quaternion. |
q2 | The second quaternion. |
dst | A quaternion to store the result in. |
void normalize | ( | ) |
Normalizes this quaternion to have unit length.
If the quaternion already has unit length or if the length of the quaternion is zero, this method does nothing.
var normalize | ( | ) |
Normalizes this quaternion to have unit length.
If the quaternion already has unit length or if the length of the quaternion is zero, this method does nothing.
local normalize | ( | ) |
Normalizes this quaternion to have unit length.
If the quaternion already has unit length or if the length of the quaternion is zero, this method does nothing.
|
inline |
Calculates the quaternion product of this quaternion with the given quaternion.
Note: this does not modify this quaternion.
q | The quaternion to multiply. |
|
inline |
Calculates the quaternion product of this quaternion with the given quaternion.
Note: this does not modify this quaternion.
q | The quaternion to multiply. |
|
inline |
Calculates the quaternion product of this quaternion with the given quaternion.
Note: this does not modify this quaternion.
q | The quaternion to multiply. |
|
inline |
Multiplies this quaternion with the given quaternion.
q | The quaternion to multiply. |
|
inline |
Multiplies this quaternion with the given quaternion.
q | The quaternion to multiply. |
|
inline |
Multiplies this quaternion with the given quaternion.
q | The quaternion to multiply. |
void set | ( | float | xx, |
float | yy, | ||
float | zz, | ||
float | ww | ||
) |
Sets the elements of the quaternion to the specified values.
xx | The new x-value. |
yy | The new y-value. |
zz | The new z-value. |
ww | The new w-value. |
var set | ( | var | xx, |
var | yy, | ||
var | zz, | ||
var | ww | ||
) |
Sets the elements of the quaternion to the specified values.
xx | The new x-value. |
yy | The new y-value. |
zz | The new z-value. |
ww | The new w-value. |
local set | ( | local | xx, |
local | yy, | ||
local | zz, | ||
local | ww | ||
) |
Sets the elements of the quaternion to the specified values.
xx | The new x-value. |
yy | The new y-value. |
zz | The new z-value. |
ww | The new w-value. |
void set | ( | float * | array | ) |
Sets the elements of the quaternion from the values in the specified array.
array | An array containing the elements of the quaternion in the order x, y, z, w. |
var set | ( | var | array | ) |
Sets the elements of the quaternion from the values in the specified array.
array | An array containing the elements of the quaternion in the order x, y, z, w. |
local set | ( | local | array | ) |
Sets the elements of the quaternion from the values in the specified array.
array | An array containing the elements of the quaternion in the order x, y, z, w. |
void set | ( | const Mat4 & | m | ) |
Sets the quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
var set | ( | var | m | ) |
Sets the quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
local set | ( | local | m | ) |
Sets the quaternion equal to the rotational part of the specified matrix.
m | The matrix. |
void set | ( | const Vec3 & | axis, |
float | angle | ||
) |
Sets the quaternion equal to the rotation from the specified axis and angle.
axis | The axis of rotation. |
angle | The angle of rotation (in radians). |
var set | ( | var | axis, |
var | angle | ||
) |
Sets the quaternion equal to the rotation from the specified axis and angle.
axis | The axis of rotation. |
angle | The angle of rotation (in radians). |
local set | ( | local | axis, |
local | angle | ||
) |
Sets the quaternion equal to the rotation from the specified axis and angle.
axis | The axis of rotation. |
angle | The angle of rotation (in radians). |
void set | ( | const Quaternion & | q | ) |
Sets the elements of this quaternion to a copy of the specified quaternion.
q | The quaternion to copy. |
var set | ( | var | q | ) |
Sets the elements of this quaternion to a copy of the specified quaternion.
q | The quaternion to copy. |
local set | ( | local | q | ) |
Sets the elements of this quaternion to a copy of the specified quaternion.
q | The quaternion to copy. |
void setIdentity | ( | ) |
Sets this quaternion to be equal to the identity quaternion.
var setIdentity | ( | ) |
Sets this quaternion to be equal to the identity quaternion.
local setIdentity | ( | ) |
Sets this quaternion to be equal to the identity quaternion.
|
static |
Interpolates between two quaternions using spherical linear interpolation.
Spherical linear interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be at (or close to) unit length. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates between two quaternions using spherical linear interpolation.
Spherical linear interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be at (or close to) unit length. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates between two quaternions using spherical linear interpolation.
Spherical linear interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be at (or close to) unit length. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates over a series of quaternions using spherical spline interpolation.
Spherical spline interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be unit. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
s1 | The first control point. |
s2 | The second control point. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates over a series of quaternions using spherical spline interpolation.
Spherical spline interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be unit. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
s1 | The first control point. |
s2 | The second control point. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
|
static |
Interpolates over a series of quaternions using spherical spline interpolation.
Spherical spline interpolation provides smooth transitions between different orientations and is often useful for animating models or cameras in 3D.
Note: For accurate interpolation, the input quaternions must be unit. This method does not automatically normalize the input quaternions, so it is up to the caller to ensure they call normalize beforehand, if necessary.
q1 | The first quaternion. |
q2 | The second quaternion. |
s1 | The first control point. |
s2 | The second control point. |
t | The interpolation coefficient. |
dst | A quaternion to store the result in. |
float toAxisAngle | ( | Vec3 * | e | ) | const |
Converts this Quaternion4f to axis-angle notation.
The axis is normalized.
e | The Vec3f which stores the axis. |
var toAxisAngle | ( | var | e | ) |
Converts this Quaternion4f to axis-angle notation.
The axis is normalized.
e | The Vec3f which stores the axis. |
local toAxisAngle | ( | local | e | ) |
Converts this Quaternion4f to axis-angle notation.
The axis is normalized.
e | The Vec3f which stores the axis. |
|
static |
Returns the quaternion with all zeros.
|
static |
Returns the quaternion with all zeros.
|
static |
Returns the quaternion with all zeros.
|
friend |
|
friend |
|
friend |
|
friend |
float w |
The scalar component of the quaternion.
var w |
The scalar component of the quaternion.
local w |
The scalar component of the quaternion.
float x |
The x-value of the quaternion's vector component.
var x |
The x-value of the quaternion's vector component.
local x |
The x-value of the quaternion's vector component.
float y |
The y-value of the quaternion's vector component.
var y |
The y-value of the quaternion's vector component.
local y |
The y-value of the quaternion's vector component.
float z |
The z-value of the quaternion's vector component.
var z |
The z-value of the quaternion's vector component.
local z |
The z-value of the quaternion's vector component.
|
static |
equals to Quaternion(0,0,0, 0)