|  | VTK
    9.0.1
    | 
 
 
 
Go to the documentation of this file.
   33 #ifndef vtkQuaternion_h 
   34 #define vtkQuaternion_h 
   68   vtkQuaternion(
const T& w, 
const T& x, 
const T& y, 
const T& z);
 
  168   void Set(
const T& w, 
const T& x, 
const T& y, 
const T& z);
 
  170   void Get(T quat[4]) 
const;
 
  177   void SetW(
const T& w);
 
  178   const T& 
GetW() 
const;
 
  185   void SetX(
const T& x);
 
  186   const T& 
GetX() 
const;
 
  193   void SetY(
const T& y);
 
  194   const T& 
GetY() 
const;
 
  201   void SetZ(
const T& z);
 
  202   const T& 
GetZ() 
const;
 
  218   template <
typename CastTo>
 
  298 #define vtkQuaternionIdentity(quaternionType, type)                                                \ 
  299   quaternionType Identity() const                                                                  \ 
  301     return quaternionType(vtkQuaternion<type>::Identity().GetData());                              \ 
  303 #define vtkQuaternionNormalized(quaternionType, type)                                              \ 
  304   quaternionType Normalized() const                                                                \ 
  306     return quaternionType(vtkQuaternion<type>::Normalized().GetData());                            \ 
  308 #define vtkQuaternionConjugated(quaternionType, type)                                              \ 
  309   quaternionType Conjugated() const                                                                \ 
  311     return quaternionType(vtkQuaternion<type>::Conjugated().GetData());                            \ 
  313 #define vtkQuaternionInverse(quaternionType, type)                                                 \ 
  314   quaternionType Inverse() const                                                                   \ 
  316     return quaternionType(vtkQuaternion<type>::Inverse().GetData());                               \ 
  318 #define vtkQuaternionUnitLog(quaternionType, type)                                                 \ 
  319   quaternionType UnitLog() const                                                                   \ 
  321     return quaternionType(vtkQuaternion<type>::UnitLog().GetData());                               \ 
  323 #define vtkQuaternionUnitExp(quaternionType, type)                                                 \ 
  324   quaternionType UnitExp() const                                                                   \ 
  326     return quaternionType(vtkQuaternion<type>::UnitExp().GetData());                               \ 
  328 #define vtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type)                            \ 
  329   quaternionType NormalizedWithAngleInDegrees() const                                              \ 
  331     return quaternionType(vtkQuaternion<type>::NormalizedWithAngleInDegrees().GetData());          \ 
  333 #define vtkQuaternionSlerp(quaternionType, type)                                                   \ 
  334   quaternionType Slerp(type t, const quaternionType& q) const                                      \ 
  336     return quaternionType(vtkQuaternion<type>::Slerp(t, q).GetData());                             \ 
  338 #define vtkQuaternionInnerPoint(quaternionType, type)                                              \ 
  339   quaternionType InnerPoint(const quaternionType& q1, const quaternionType& q2) const              \ 
  341     return quaternionType(vtkQuaternion<type>::InnerPoint(q1, q2).GetData());                      \ 
  343 #define vtkQuaternionOperatorPlus(quaternionType, type)                                            \ 
  344   inline quaternionType operator+(const quaternionType& q) const                                   \ 
  346     return quaternionType(                                                                         \ 
  347       (static_cast<vtkQuaternion<type> >(*this) + static_cast<vtkQuaternion<type> >(q))            \ 
  350 #define vtkQuaternionOperatorMinus(quaternionType, type)                                           \ 
  351   inline quaternionType operator-(const quaternionType& q) const                                   \ 
  353     return quaternionType(                                                                         \ 
  354       (static_cast<vtkQuaternion<type> >(*this) - static_cast<vtkQuaternion<type> >(q))            \ 
  357 #define vtkQuaternionOperatorMultiply(quaternionType, type)                                        \ 
  358   inline quaternionType operator*(const quaternionType& q) const                                   \ 
  360     return quaternionType(                                                                         \ 
  361       (static_cast<vtkQuaternion<type> >(*this) * static_cast<vtkQuaternion<type> >(q))            \ 
  364 #define vtkQuaternionOperatorMultiplyScalar(quaternionType, type)                                  \ 
  365   inline quaternionType operator*(const type& scalar) const                                        \ 
  367     return quaternionType((static_cast<vtkQuaternion<type> >(*this) * scalar).GetData());          \ 
  369 #define vtkQuaternionOperatorDivide(quaternionType, type)                                          \ 
  370   inline quaternionType operator/(const quaternionType& q) const                                   \ 
  372     return quaternionType(                                                                         \ 
  373       (static_cast<vtkQuaternion<type> >(*this) / static_cast<vtkQuaternion<type> >(q))            \ 
  376 #define vtkQuaternionOperatorDivideScalar(quaternionType, type)                                    \ 
  377   inline quaternionType operator/(const type& scalar) const                                        \ 
  379     return quaternionType((static_cast<vtkQuaternion<type> >(*this) / scalar).GetData());          \ 
  382 #define vtkQuaternionOperatorMacro(quaternionType, type)                                           \ 
  383   vtkQuaternionIdentity(quaternionType, type);                                                     \ 
  384   vtkQuaternionNormalized(quaternionType, type);                                                   \ 
  385   vtkQuaternionConjugated(quaternionType, type);                                                   \ 
  386   vtkQuaternionInverse(quaternionType, type);                                                      \ 
  387   vtkQuaternionUnitLog(quaternionType, type);                                                      \ 
  388   vtkQuaternionUnitExp(quaternionType, type);                                                      \ 
  389   vtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type);                                 \ 
  390   vtkQuaternionSlerp(quaternionType, type);                                                        \ 
  391   vtkQuaternionInnerPoint(quaternionType, type);                                                   \ 
  392   vtkQuaternionOperatorPlus(quaternionType, type);                                                 \ 
  393   vtkQuaternionOperatorMinus(quaternionType, type);                                                \ 
  394   vtkQuaternionOperatorMultiply(quaternionType, type);                                             \ 
  395   vtkQuaternionOperatorMultiplyScalar(quaternionType, type);                                       \ 
  396   vtkQuaternionOperatorDivide(quaternionType, type);                                               \ 
  397   vtkQuaternionOperatorDivideScalar(quaternionType, type) 
  449 #include "vtkQuaternion.txx" 
  451 #endif // vtkQuaternion_h 
  
void Invert()
Invert the quaternion in place.
vtkQuaternion< T > Conjugated() const
Return the conjugate form of this quaternion.
vtkQuaternion< T > Normalized() const
Return the normalized form of this quaternion.
vtkQuaternion(const T *init)
Initialize the quaternion's elements with the elements of the supplied array.
vtkQuaternion< T > InnerPoint(const vtkQuaternion< T > &q1, const vtkQuaternion< T > &q2) const
Interpolates between quaternions, using spherical quadrangle interpolation.
void ToUnitExp()
Convert this quaternion to a unit exponential quaternion.
vtkQuaternion< T > operator/(const vtkQuaternion< T > &q) const
Performs division of quaternions of the same type.
vtkQuaternion< T > Inverse() const
Return the inverted form of this quaternion.
T SquaredNorm() const
Get the squared norm of the quaternion.
vtkQuaterniond(const double *init)
void ToIdentity()
Set the quaternion to identity in place.
void Conjugate()
Conjugate the quaternion in place.
vtkQuaternion< T > operator+(const vtkQuaternion< T > &q) const
Performs addition of quaternion of the same basic type.
vtkQuaternionOperatorMacro(vtkQuaternionf, float)
T Norm() const
Get the norm of the quaternion, i.e.
void FromMatrix3x3(const T A[3][3])
Convert a 3x3 matrix into a quaternion.
vtkQuaternion< T > NormalizedWithAngleInDegrees() const
Returns a quaternion normalized and transformed so its angle is in degrees and its axis normalized.
vtkQuaternion< CastTo > Cast() const
Cast the quaternion to the specified type and return the result.
vtkQuaternion< T > operator-(const vtkQuaternion< T > &q) const
Performs subtraction of quaternions of the same basic type.
void operator/=(const T &scalar)
Performs in place division of the quaternions by a scalar value.
vtkQuaternion< T > UnitExp() const
Return the unit exponential version of this quaternion.
static vtkQuaternion< T > Identity()
Return the identity quaternion.
void ToMatrix3x3(T A[3][3]) const
Convert a quaternion to a 3x3 rotation matrix.
void SetZ(const T &z)
Set/Get the y component of the quaternion, i.e.
vtkQuaternion()
Default constructor.
T Normalize()
Normalize the quaternion in place.
vtkQuaternion(const T &scalar)
Initialize all of the quaternion's elements with the supplied scalar.
vtkQuaternionf(const float *init)
templated base type for storage of quaternions.
vtkQuaternion< T > Slerp(T t, const vtkQuaternion< T > &q) const
Interpolate quaternions using spherical linear interpolation between this quaternion and q1 to produc...
vtkQuaterniond(double scalar)
void NormalizeWithAngleInDegrees()
Normalize a quaternion in place and transform it to so its angle is in degrees and its axis normalize...
vtkQuaternionOperatorMacro(vtkQuaterniond, double)
void SetRotationAngleAndAxis(T angle, T axis[3])
void SetX(const T &x)
Set/Get the x component of the quaternion, i.e.
vtkQuaternionf(float scalar)
vtkQuaternion< T > operator*(const vtkQuaternion< T > &q) const
Performs multiplication of quaternion of the same basic type.
vtkQuaternionf(float w, float x, float y, float z)
vtkQuaterniond(double w, double x, double y, double z)
void ToUnitLog()
Convert this quaternion to a unit log quaternion.
templated base type for containers of constant size.
T GetRotationAngleAndAxis(T axis[3]) const
Set/Get the angle (in radians) and the axis corresponding to the axis-angle rotation of this quaterni...
void SetW(const T &w)
Set/Get the w component of the quaternion, i.e.
void operator*=(const T &scalar) const
Performs in place multiplication of the quaternions by a scalar value.
void Set(const T &w, const T &x, const T &y, const T &z)
Set/Get the w, x, y and z components of the quaternion.
void SetY(const T &y)
Set/Get the y component of the quaternion, i.e.
vtkQuaternion< T > UnitLog() const
Return the unit log version of this quaternion.
void Get(T quat[4]) const