Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::TQuaternion< T > Struct Template Reference

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...
 
TQuaternionoperator+= (const TQuaternion &q)
 Add another quaternions to the current one. More...
 
TQuaternionoperator-= (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...
 
TQuaternionoperator*= (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...
 
TQuaternionoperator/= (T f)
 Divide the quaternion by the given scalar. More...
 
TQuaternionoperator*= (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...
 
w
 Real component. More...
 

Detailed Description

template<typename T>
struct mitsuba::TQuaternion< T >

Parameterizable quaternion data structure.

Member Typedef Documentation

template<typename T>
typedef T mitsuba::TQuaternion< T >::Scalar

Member Enumeration Documentation

Used by TQuaternion::fromEulerAngles.

Enumerator
EEulerXYZ 
EEulerXZY 
EEulerYXZ 
EEulerYZX 
EEulerZXY 
EEulerZYX 

Constructor & Destructor Documentation

template<typename T>
mitsuba::TQuaternion< T >::TQuaternion ( )
inline

Create a unit quaternion.

template<typename T>
mitsuba::TQuaternion< T >::TQuaternion ( const TVector3< T > &  v,
w 
)
inline

Initialize the quaternion with the specified real and imaginary components

template<typename T>
mitsuba::TQuaternion< T >::TQuaternion ( Stream stream)
inlineexplicit

Unserialize a quaternion from a binary data stream.

Member Function Documentation

template<typename T>
Scalar mitsuba::TQuaternion< T >::angle ( ) const
inline

Return the rotation angle of this quaternion (in radians)

template<typename T>
TVector3<T> mitsuba::TQuaternion< T >::axis ( ) const
inline

Return the rotation axis of this quaternion.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::exp ( ) const
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

template<typename T>
static TQuaternion mitsuba::TQuaternion< T >::fromAxisAngle ( const Vector axis,
Float  angle 
)
inlinestatic

Construct an unit quaternion, which represents a rotation around axis by angle radians.

template<typename T>
static TQuaternion mitsuba::TQuaternion< T >::fromDirectionPair ( const Vector from,
const Vector to 
)
inlinestatic

Construct an unit quaternion, which rotates unit direction from onto to.

template<typename T>
static TQuaternion mitsuba::TQuaternion< T >::fromEulerAngles ( EEulerAngleConvention  conv,
Float  x,
Float  y,
Float  z 
)
inlinestatic

Construct an unit quaternion matching the supplied rotation expressed in Euler angles (in radians)

template<typename T>
static TQuaternion mitsuba::TQuaternion< T >::fromMatrix ( const Matrix4x4 m)
inlinestatic

Construct an unit quaternion matching the supplied rotation matrix.

template<typename T>
static TQuaternion mitsuba::TQuaternion< T >::fromTransform ( const Transform trafo)
inlinestatic
template<typename T>
bool mitsuba::TQuaternion< T >::isIdentity ( ) const
inline

Identity test.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::log ( ) const
inline

Compute the natural logarithm of a unit quaternion.

Based on code the appendix of "Quaternion Calculus for Computer Graphics" by Ken Shoemake

template<typename T>
bool mitsuba::TQuaternion< T >::operator!= ( const TQuaternion< T > &  q) const
inline

Inequality test.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator* ( f) const
inline

Multiply the quaternion by the given scalar and return the result.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator* ( const TQuaternion< T > &  q) const
inline

Quaternion multiplication (creates a temporary)

template<typename T>
TQuaternion& mitsuba::TQuaternion< T >::operator*= ( f)
inline

Multiply the quaternion by the given scalar.

template<typename T>
TQuaternion& mitsuba::TQuaternion< T >::operator*= ( const TQuaternion< T > &  q)
inline

Quaternion multiplication.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator+ ( const TQuaternion< T > &  q) const
inline

Add two quaternions and return the result.

template<typename T>
TQuaternion& mitsuba::TQuaternion< T >::operator+= ( const TQuaternion< T > &  q)
inline

Add another quaternions to the current one.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator- ( const TQuaternion< T > &  q) const
inline

Subtract two quaternions and return the result.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator- ( ) const
inline

Unary negation operator.

template<typename T>
TQuaternion& mitsuba::TQuaternion< T >::operator-= ( const TQuaternion< T > &  q)
inline

Subtract a quaternion.

template<typename T>
TQuaternion mitsuba::TQuaternion< T >::operator/ ( f) const
inline

Divide the quaternion by the given scalar and return the result.

template<typename T>
TQuaternion& mitsuba::TQuaternion< T >::operator/= ( f)
inline

Divide the quaternion by the given scalar.

template<typename T>
bool mitsuba::TQuaternion< T >::operator== ( const TQuaternion< T > &  q) const
inline

Equality test.

template<typename T>
void mitsuba::TQuaternion< T >::serialize ( Stream stream) const
inline

Serialize this quaternion to a binary data stream.

template<typename T>
std::string mitsuba::TQuaternion< T >::toString ( ) const
inline

Return a readable string representation of this quaternion.

template<typename T>
Transform mitsuba::TQuaternion< T >::toTransform ( ) const
inline

Compute the rotation matrix for the given quaternion.

Implementation from PBRT

Member Data Documentation

template<typename T>
TVector3<T> mitsuba::TQuaternion< T >::v

Imaginary component.

template<typename T>
T mitsuba::TQuaternion< T >::w

Real component.


The documentation for this struct was generated from the following file: