Parameterizable quaternion data structure. More...
#include <mitsuba/core/quat.h>
Public Types | |
enum | EEulerAngleConvention { EEulerXYZ = 0, EEulerXZY, EEulerYXZ, EEulerYZX, EEulerZXY, EEulerZYX } |
Used by TQuaternion::fromEulerAngles. More... | |
typedef T | Scalar |
Public Member Functions | |
TQuaternion () | |
Create a unit quaternion. More... | |
TQuaternion (const TVector3< T > &v, T w) | |
TQuaternion (Stream *stream) | |
Unserialize a quaternion from a binary data stream. More... | |
TQuaternion | operator+ (const TQuaternion &q) const |
Add two quaternions and return the result. More... | |
TQuaternion | operator- (const TQuaternion &q) const |
Subtract two quaternions and return the result. More... | |
TQuaternion & | operator+= (const TQuaternion &q) |
Add another quaternions to the current one. More... | |
TQuaternion & | operator-= (const TQuaternion &q) |
Subtract a quaternion. More... | |
TQuaternion | operator- () const |
Unary negation operator. More... | |
TQuaternion | operator* (T f) const |
Multiply the quaternion by the given scalar and return the result. More... | |
TQuaternion & | operator*= (T f) |
Multiply the quaternion by the given scalar. More... | |
TQuaternion | operator/ (T f) const |
Divide the quaternion by the given scalar and return the result. More... | |
TQuaternion & | operator/= (T f) |
Divide the quaternion by the given scalar. More... | |
TQuaternion & | operator*= (const TQuaternion &q) |
Quaternion multiplication. More... | |
TQuaternion | operator* (const TQuaternion &q) const |
Quaternion multiplication (creates a temporary) More... | |
bool | operator== (const TQuaternion &q) const |
Equality test. More... | |
bool | operator!= (const TQuaternion &q) const |
Inequality test. More... | |
bool | isIdentity () const |
Identity test. More... | |
TVector3< T > | axis () const |
Return the rotation axis of this quaternion. More... | |
Scalar | angle () const |
Return the rotation angle of this quaternion (in radians) More... | |
TQuaternion | exp () const |
Compute the exponential of a quaternion with scalar part w = 0. More... | |
TQuaternion | log () const |
Compute the natural logarithm of a unit quaternion. More... | |
Transform | toTransform () const |
Compute the rotation matrix for the given quaternion. More... | |
void | serialize (Stream *stream) const |
Serialize this quaternion to a binary data stream. More... | |
std::string | toString () const |
Return a readable string representation of this quaternion. More... | |
Static Public Member Functions | |
static TQuaternion | fromAxisAngle (const Vector &axis, Float angle) |
Construct an unit quaternion, which represents a rotation around axis by angle radians. More... | |
static TQuaternion | fromDirectionPair (const Vector &from, const Vector &to) |
Construct an unit quaternion, which rotates unit direction from onto to. More... | |
static TQuaternion | fromTransform (const Transform &trafo) |
static TQuaternion | fromMatrix (const Matrix4x4 &m) |
Construct an unit quaternion matching the supplied rotation matrix. More... | |
static TQuaternion | fromEulerAngles (EEulerAngleConvention conv, Float x, Float y, Float z) |
Construct an unit quaternion matching the supplied rotation expressed in Euler angles (in radians) More... | |
Public Attributes | |
TVector3< T > | v |
Imaginary component. More... | |
T | w |
Real component. More... | |
Parameterizable quaternion data structure.
typedef T mitsuba::TQuaternion< T >::Scalar |
enum mitsuba::TQuaternion::EEulerAngleConvention |
Used by TQuaternion::fromEulerAngles.
Enumerator | |
---|---|
EEulerXYZ | |
EEulerXZY | |
EEulerYXZ | |
EEulerYZX | |
EEulerZXY | |
EEulerZYX |
|
inline |
Create a unit quaternion.
|
inline |
Initialize the quaternion with the specified real and imaginary components
|
inlineexplicit |
Unserialize a quaternion from a binary data stream.
|
inline |
Return the rotation angle of this quaternion (in radians)
|
inline |
Return the rotation axis of this quaternion.
|
inline |
Compute the exponential of a quaternion with scalar part w = 0.
Based on code the appendix of "Quaternion Calculus for Computer Graphics" by Ken Shoemake
|
inlinestatic |
Construct an unit quaternion, which represents a rotation around axis by angle radians.
|
inlinestatic |
Construct an unit quaternion, which rotates unit direction from onto to.
|
inlinestatic |
Construct an unit quaternion matching the supplied rotation expressed in Euler angles (in radians)
|
inlinestatic |
Construct an unit quaternion matching the supplied rotation matrix.
|
inlinestatic |
|
inline |
Identity test.
|
inline |
Compute the natural logarithm of a unit quaternion.
Based on code the appendix of "Quaternion Calculus for Computer Graphics" by Ken Shoemake
|
inline |
Inequality test.
|
inline |
Multiply the quaternion by the given scalar and return the result.
|
inline |
Quaternion multiplication (creates a temporary)
|
inline |
Multiply the quaternion by the given scalar.
|
inline |
Quaternion multiplication.
|
inline |
Add two quaternions and return the result.
|
inline |
Add another quaternions to the current one.
|
inline |
Subtract two quaternions and return the result.
|
inline |
Unary negation operator.
|
inline |
Subtract a quaternion.
|
inline |
Divide the quaternion by the given scalar and return the result.
|
inline |
Divide the quaternion by the given scalar.
|
inline |
Equality test.
|
inline |
Serialize this quaternion to a binary data stream.
|
inline |
Return a readable string representation of this quaternion.
|
inline |
Compute the rotation matrix for the given quaternion.
Implementation from PBRT
TVector3<T> mitsuba::TQuaternion< T >::v |
Imaginary component.
T mitsuba::TQuaternion< T >::w |
Real component.