HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Quat< T > Class Template Reference

#include <ImathQuat.h>

Public Types

typedef T BaseType
 

Public Member Functions

IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 T
operator[] (int index) IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE constexpr T operator[] (int index) const IMATH_NOEXCEPT
 
Basic Algebra

Note that the operator return values are NOT normalized

IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator*= (const Quat< T > &q) IMATH_NOEXCEPT
 Quaternion multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator*= (T t) IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator/= (const Quat< T > &q) IMATH_NOEXCEPT
 Quaterion division, using the inverse() More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator/= (T t) IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator+= (const Quat< T > &q) IMATH_NOEXCEPT
 Quaternion addition. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator-= (const Quat< T > &q) IMATH_NOEXCEPT
 Quaternion subtraction. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator== (const Quat< S > &q) const IMATH_NOEXCEPT
 Equality. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator!= (const Quat< S > &q) const IMATH_NOEXCEPT
 Inequality. More...
 
Query
IMATH_HOSTDEVICE constexpr T length () const IMATH_NOEXCEPT
 Return the R4 length. More...
 
IMATH_HOSTDEVICE constexpr T angle () const IMATH_NOEXCEPT
 Return the angle of the axis/angle representation. More...
 
IMATH_HOSTDEVICE constexpr
Vec3< T
axis () const IMATH_NOEXCEPT
 Return the axis of the axis/angle representation. More...
 
IMATH_HOSTDEVICE constexpr
Matrix33< T
toMatrix33 () const IMATH_NOEXCEPT
 Return a 3x3 rotation matrix. More...
 
IMATH_HOSTDEVICE constexpr
Matrix44< T
toMatrix44 () const IMATH_NOEXCEPT
 Return a 4x4 rotation matrix. More...
 
IMATH_HOSTDEVICE Quat< Tlog () const IMATH_NOEXCEPT
 Return the logarithm of the quaterion. More...
 
IMATH_HOSTDEVICE Quat< Texp () const IMATH_NOEXCEPT
 Return the exponent of the quaterion. More...
 
Utility Methods
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T > & 
invert () IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T
inverse () const IMATH_NOEXCEPT
 Return 1/this, leaving this unchanged. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T > & 
normalize () IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T
normalized () const IMATH_NOEXCEPT
 Return a normalized quaternion, leaving this unmodified. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Vec3< T
rotateVector (const Vec3< T > &original) const IMATH_NOEXCEPT
 Rotate the given point by the quaterion. More...
 
IMATH_HOSTDEVICE constexpr T euclideanInnerProduct (const Quat< T > &q) const IMATH_NOEXCEPT
 Return the Euclidean inner product. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T > & 
setAxisAngle (const Vec3< T > &axis, T radians) IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 Quat< T > & 
setRotation (const Vec3< T > &fromDirection, const Vec3< T > &toDirection) IMATH_NOEXCEPT
 

Public Attributes

Direct access to elements
T r
 The real part. More...
 
Vec3< Tv
 The imaginary vector. More...
 

Constructors

IMATH_HOSTDEVICE constexpr Quat () IMATH_NOEXCEPT
 Default constructor is the identity quat. More...
 
IMATH_HOSTDEVICE constexpr Quat (const Quat &q) IMATH_NOEXCEPT
 Copy constructor. More...
 
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat (const Quat< S > &q) IMATH_NOEXCEPT
 Construct from a quaternion of a another base type. More...
 
IMATH_HOSTDEVICE constexpr Quat (T s, T i, T j, T k) IMATH_NOEXCEPT
 Initialize with real part s and imaginary vector 1(i,j,k)`. More...
 
IMATH_HOSTDEVICE constexpr Quat (T s, Vec3< T > d) IMATH_NOEXCEPT
 Initialize with real part s and imaginary vector d More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Quat
< T > & 
operator= (const Quat< T > &q) IMATH_NOEXCEPT
 Assignment. More...
 
IMATH_HOSTDEVICE ~Quat () IMATH_NOEXCEPT=default
 Destructor. More...
 
IMATH_HOSTDEVICE static
constexpr Quat< T
identity () IMATH_NOEXCEPT
 The identity quaternion. More...
 

Detailed Description

template<class T>
class Quat< T >

The Quat class implements the quaternion numerical type – you will probably want to use this class to represent orientations in R3 and to convert between various euler angle reps. You should probably use Imath::Euler<> for that.

Definition at line 42 of file ImathQuat.h.

Member Typedef Documentation

template<class T>
typedef T Quat< T >::BaseType

The base type: In templates that accept a parameter V, you can refer to T as V::BaseType

Definition at line 193 of file ImathQuat.h.

Constructor & Destructor Documentation

template<class T >
IMATH_HOSTDEVICE constexpr Quat< T >::Quat ( )
inline

Default constructor is the identity quat.

Definition at line 272 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Quat< T >::Quat ( const Quat< T > &  q)
inline

Copy constructor.

Definition at line 297 of file ImathQuat.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T >::Quat ( const Quat< S > &  q)
inline

Construct from a quaternion of a another base type.

Definition at line 279 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Quat< T >::Quat ( T  s,
T  i,
T  j,
T  k 
)
inline

Initialize with real part s and imaginary vector 1(i,j,k)`.

Definition at line 285 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Quat< T >::Quat ( T  s,
Vec3< T d 
)
inline

Initialize with real part s and imaginary vector d

Definition at line 291 of file ImathQuat.h.

template<class T>
IMATH_HOSTDEVICE Quat< T >::~Quat ( )
default

Destructor.

Member Function Documentation

template<class T >
IMATH_HOSTDEVICE constexpr T Quat< T >::angle ( ) const
inline

Return the angle of the axis/angle representation.

Definition at line 669 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Vec3< T > Quat< T >::axis ( ) const
inline

Return the axis of the axis/angle representation.

Definition at line 676 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr T Quat< T >::euclideanInnerProduct ( const Quat< T > &  q) const
inline

Return the Euclidean inner product.

Definition at line 491 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE Quat< T > Quat< T >::exp ( ) const
inline

Return the exponent of the quaterion.

Definition at line 645 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Quat< T > Quat< T >::identity ( )
inlinestatic

The identity quaternion.

Definition at line 304 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > Quat< T >::inverse ( ) const
inline

Return 1/this, leaving this unchanged.

Definition at line 447 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > & Quat< T >::invert ( )
inline

Invert in place: this = 1 / this.

Returns
const reference to this.

Definition at line 461 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr T Quat< T >::length ( void  ) const
inline

Return the R4 length.

Definition at line 412 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE Quat< T > Quat< T >::log ( ) const
inline

Return the logarithm of the quaterion.

Definition at line 620 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > & Quat< T >::normalize ( )
inline

Normalize in place

Returns
const reference to this.

Definition at line 419 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > Quat< T >::normalized ( ) const
inline

Return a normalized quaternion, leaving this unmodified.

Definition at line 437 of file ImathQuat.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Quat< T >::operator!= ( const Quat< S > &  q) const
inline

Inequality.

Definition at line 397 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator*= ( const Quat< T > &  q)
inline

Quaternion multiplication.

Definition at line 320 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator*= ( T  t)
inline

Scalar multiplication: multiply both real and imaginary parts by the given scalar.

Definition at line 330 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator+= ( const Quat< T > &  q)
inline

Quaternion addition.

Definition at line 356 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator-= ( const Quat< T > &  q)
inline

Quaternion subtraction.

Definition at line 365 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator/= ( const Quat< T > &  q)
inline

Quaterion division, using the inverse()

Definition at line 339 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator/= ( T  t)
inline

Scalar division: multiply both real and imaginary parts by the given scalar.

Definition at line 347 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat< T > & Quat< T >::operator= ( const Quat< T > &  q)
inline

Assignment.

Definition at line 311 of file ImathQuat.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Quat< T >::operator== ( const Quat< S > &  q) const
inline

Equality.

Definition at line 389 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T & Quat< T >::operator[] ( int  index)
inline

Element access: q[0] is the real part, (q[1],q[2],q[3]) is the imaginary part.

Definition at line 374 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr T Quat< T >::operator[] ( int  index) const
inline

Element access: q[0] is the real part, (q[1],q[2],q[3]) is the imaginary part.

Definition at line 381 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3< T > Quat< T >::rotateVector ( const Vec3< T > &  original) const
inline

Rotate the given point by the quaterion.

Definition at line 471 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > & Quat< T >::setAxisAngle ( const Vec3< T > &  axis,
T  radians 
)
inline

Set the quaterion to be a rotation around the given axis by the given angle.

Returns
const reference to this.

Definition at line 683 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat< T > & Quat< T >::setRotation ( const Vec3< T > &  fromDirection,
const Vec3< T > &  toDirection 
)
inline

Set the quaternion to be a rotation that transforms the direction vector fromDirection to toDirection

Returns
const reference to this.

Definition at line 692 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Matrix33< T > Quat< T >::toMatrix33 ( ) const
inline

Return a 3x3 rotation matrix.

Definition at line 797 of file ImathQuat.h.

template<class T >
IMATH_HOSTDEVICE constexpr Matrix44< T > Quat< T >::toMatrix44 ( ) const
inline

Return a 4x4 rotation matrix.

Definition at line 814 of file ImathQuat.h.

Member Data Documentation

template<class T>
T Quat< T >::r

The real part.

Definition at line 50 of file ImathQuat.h.

template<class T>
Vec3<T> Quat< T >::v

The imaginary vector.

Definition at line 53 of file ImathQuat.h.


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