#include <opennurbs_quaternion.h>
Public Member Functions | |
ON_Quaternion () | |
ON_Quaternion (double qa, double qb, double qc, double qd) | |
ON_Quaternion (const ON_3dVector &v) | |
(a,b,c,d) = (0,v.x,v.y,v.z) More... | |
ON_Quaternion | Conjugate () const |
Returns the conjugate of the quaternion = (a,-b,-c,-d). More... | |
double | DistanceTo (const ON_Quaternion &q) const |
bool | GetRotation (double &angle, ON_3dVector &axis) const |
bool | GetRotation (ON_Xform &xform) const |
The transformation returned by this function has the property that xform*V = q.Rotate(V). More... | |
bool | GetRotation (ON_Plane &plane) const |
ON_Quaternion | Inverse () const |
bool | Invert () |
Sets the quaternion to a/L2, -b/L2, -c/L2, -d/L2, where L2 = length squared = (a*a + b*b + c*c + d*d). This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0). More... | |
bool | IsNotZero () const |
bool | IsScalar () const |
bool | IsValid () const |
bool | IsVector () const |
bool | IsZero () const |
double | Length () const |
double | LengthSquared () const |
ON_Xform | MatrixForm () const |
ON_Quaternion | operator* (int) const |
arithmetic operators More... | |
ON_Quaternion | operator* (float) const |
ON_Quaternion | operator* (double) const |
ON_Quaternion | operator* (const ON_Quaternion &) const |
quaternion multiplication is not commutative More... | |
ON_Quaternion | operator+ (const ON_Quaternion &) const |
ON_Quaternion | operator- (const ON_Quaternion &) const |
ON_Quaternion | operator/ (int) const |
ON_Quaternion | operator/ (float) const |
ON_Quaternion | operator/ (double) const |
ON_Quaternion & | operator= (const ON_3dVector &v) |
(a,b,c,d) = (0,v.x,v.y,v.z) More... | |
ON_3dVector | Rotate (ON_3dVector v) const |
double | Scalar () const |
void | Set (double qa, double qb, double qc, double qd) |
void | SetRotation (double angle, const ON_3dVector &axis) |
Sets the quaternion to More... | |
void | SetRotation (const ON_Plane &plane0, const ON_Plane &plane1) |
bool | Unitize () |
Scales the quaternion's coordinates so that a*a + b*b + c*c + d*d = 1. More... | |
ON_3dVector | Vector () const |
Static Public Member Functions | |
static double | Distance (const ON_Quaternion &p, const ON_Quaternion &q) |
static ON_Quaternion | Exp (ON_Quaternion q) |
static ON_Quaternion | Log (ON_Quaternion q) |
static ON_Quaternion | Pow (ON_Quaternion q, double t) |
static ON_Quaternion | Rotation (double angle, const ON_3dVector &axis) |
static ON_Quaternion | Rotation (const ON_Plane &plane0, const ON_Plane &plane1) |
static ON_Quaternion | Slerp (ON_Quaternion q0, ON_Quaternion q1, double t) |
Public Attributes | |
double | a |
quaternion = a + bi + cj + dk More... | |
double | b |
double | c |
double | d |
Static Public Attributes | |
static const ON_Quaternion | I |
static const ON_Quaternion | Identity |
static const ON_Quaternion | J |
static const ON_Quaternion | K |
static const ON_Quaternion | Zero |
|
inline |
ON_Quaternion::ON_Quaternion | ( | double | qa, |
double | qb, | ||
double | qc, | ||
double | qd | ||
) |
ON_Quaternion::ON_Quaternion | ( | const ON_3dVector & | v | ) |
(a,b,c,d) = (0,v.x,v.y,v.z)
ON_Quaternion ON_Quaternion::Conjugate | ( | ) | const |
Returns the conjugate of the quaternion = (a,-b,-c,-d).
|
static |
double ON_Quaternion::DistanceTo | ( | const ON_Quaternion & | q | ) | const |
|
static |
bool ON_Quaternion::GetRotation | ( | double & | angle, |
ON_3dVector & | axis | ||
) | const |
angle | [out] in radians |
axis | [out] unit axis of rotation of 0 if (b,c,d) is the zero vector. |
If the quaternion is not unitized, the rotation of its unitized form is returned.
bool ON_Quaternion::GetRotation | ( | ON_Xform & | xform | ) | const |
The transformation returned by this function has the property that xform*V = q.Rotate(V).
xform | [out] |
If the quaternion is not unitized, the rotation of its unitized form is returned. Do not confuse the result of this function the matrix returned by ON_Quaternion::MatrixForm(). The transformation returned by this function has the property that xform*V = q.Rotate(V).
bool ON_Quaternion::GetRotation | ( | ON_Plane & | plane | ) | const |
plane | [out] |
ON_Quaternion ON_Quaternion::Inverse | ( | ) | const |
bool ON_Quaternion::Invert | ( | ) |
Sets the quaternion to a/L2, -b/L2, -c/L2, -d/L2, where L2 = length squared = (a*a + b*b + c*c + d*d). This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0).
bool ON_Quaternion::IsNotZero | ( | ) | const |
bool ON_Quaternion::IsScalar | ( | ) | const |
bool ON_Quaternion::IsValid | ( | ) | const |
bool ON_Quaternion::IsVector | ( | ) | const |
bool ON_Quaternion::IsZero | ( | ) | const |
double ON_Quaternion::Length | ( | ) | const |
double ON_Quaternion::LengthSquared | ( | ) | const |
|
static |
ON_Xform ON_Quaternion::MatrixForm | ( | ) | const |
4x4 real valued matrix form of the quaternion
a b c d -b a -d c -c d a -b -d -c b a
which has the same arithmetic properties in as the quaternion.
Do not confuse this with the rotation defined by the quaternion. This function will only be interesting to math nerds and is not useful in rendering or animation applications.
ON_Quaternion ON_Quaternion::operator* | ( | int | ) | const |
arithmetic operators
ON_Quaternion ON_Quaternion::operator* | ( | float | ) | const |
ON_Quaternion ON_Quaternion::operator* | ( | double | ) | const |
ON_Quaternion ON_Quaternion::operator* | ( | const ON_Quaternion & | ) | const |
quaternion multiplication is not commutative
ON_Quaternion ON_Quaternion::operator+ | ( | const ON_Quaternion & | ) | const |
ON_Quaternion ON_Quaternion::operator- | ( | const ON_Quaternion & | ) | const |
ON_Quaternion ON_Quaternion::operator/ | ( | int | ) | const |
ON_Quaternion ON_Quaternion::operator/ | ( | float | ) | const |
ON_Quaternion ON_Quaternion::operator/ | ( | double | ) | const |
ON_Quaternion& ON_Quaternion::operator= | ( | const ON_3dVector & | v | ) |
(a,b,c,d) = (0,v.x,v.y,v.z)
|
static |
ON_3dVector ON_Quaternion::Rotate | ( | ON_3dVector | v | ) | const |
v | [in] |
If you need to rotate more than a dozen or so vectors, it will be more efficient to call GetRotation(ON_Xform& xform) and multiply the vectors by xform.
|
static |
angle | [in] in radians |
axis | [in] axis of rotation |
The unit quaternion
cos(angle/2), sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)*z
where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis.
|
static |
plane0 | [in] |
plane1 | [in] |
The plane origins are ignored.
double ON_Quaternion::Scalar | ( | ) | const |
void ON_Quaternion::Set | ( | double | qa, |
double | qb, | ||
double | qc, | ||
double | qd | ||
) |
void ON_Quaternion::SetRotation | ( | double | angle, |
const ON_3dVector & | axis | ||
) |
Sets the quaternion to
cos(angle/2), sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)*z
where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis.
angle | [in] in radians |
axis | [in] axis of rotation |
plane0 | [in] |
plane1 | [in] |
The plane origins are ignored.
|
static |
bool ON_Quaternion::Unitize | ( | ) |
Scales the quaternion's coordinates so that a*a + b*b + c*c + d*d = 1.
ON_3dVector ON_Quaternion::Vector | ( | ) | const |
double ON_Quaternion::a |
quaternion = a + bi + cj + dk
double ON_Quaternion::b |
double ON_Quaternion::c |
double ON_Quaternion::d |
|
static |
|
static |
|
static |
|
static |
|
static |