Go to the documentation of this file.
36 #ifndef vtkQuaternion_h
37 #define vtkQuaternion_h
64 vtkQuaternion(
const T& w,
const T& x,
const T& y,
const T& z);
164 void Set(
const T& w,
const T& x,
const T& y,
const T& z);
166 void Get(T quat[4])
const;
173 void SetW(
const T& w);
174 const T&
GetW()
const;
181 void SetX(
const T& x);
182 const T&
GetX()
const;
189 void SetY(
const T& y);
190 const T&
GetY()
const;
197 void SetZ(
const T& z);
198 const T&
GetZ()
const;
209 const T& angle,
const T& x,
const T& y,
const T& z);
295 #define vtkQuaternionIdentity(quaternionType, type) \
296 quaternionType Identity() const \
298 return quaternionType(vtkQuaternion<type>::Identity().GetData()); \
300 #define vtkQuaternionNormalized(quaternionType, type) \
301 quaternionType Normalized() const \
303 return quaternionType(vtkQuaternion<type>::Normalized().GetData()); \
305 #define vtkQuaternionConjugated(quaternionType, type) \
306 quaternionType Conjugated() const \
308 return quaternionType(vtkQuaternion<type>::Conjugated().GetData()); \
310 #define vtkQuaternionInverse(quaternionType, type) \
311 quaternionType Inverse() const \
313 return quaternionType(vtkQuaternion<type>::Inverse().GetData()); \
315 #define vtkQuaternionUnitLog(quaternionType, type) \
316 quaternionType UnitLog() const \
318 return quaternionType( \
319 vtkQuaternion<type>::UnitLog().GetData()); \
321 #define vtkQuaternionUnitExp(quaternionType, type) \
322 quaternionType UnitExp() const \
324 return quaternionType( \
325 vtkQuaternion<type>::UnitExp().GetData()); \
327 #define vtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type) \
328 quaternionType NormalizedWithAngleInDegrees() const \
330 return quaternionType( \
331 vtkQuaternion<type>::NormalizedWithAngleInDegrees().GetData()); \
333 #define vtkQuaternionSlerp(quaternionType, type) \
334 quaternionType Slerp(type t, const quaternionType& q) const \
336 return quaternionType( \
337 vtkQuaternion<type>::Slerp(t, q).GetData()); \
339 #define vtkQuaternionInnerPoint(quaternionType, type) \
340 quaternionType InnerPoint(const quaternionType& q1, \
341 const quaternionType& q2) const \
343 return quaternionType( \
344 vtkQuaternion<type>::InnerPoint(q1, q2).GetData()); \
346 #define vtkQuaternionOperatorPlus(quaternionType, type) \
347 inline quaternionType operator+(const quaternionType& q) const \
349 return quaternionType( ( \
350 static_cast< vtkQuaternion<type> > (*this) + \
351 static_cast< vtkQuaternion<type> > (q)).GetData()); \
353 #define vtkQuaternionOperatorMinus(quaternionType, type) \
354 inline quaternionType operator-(const quaternionType& q) const \
356 return quaternionType( ( \
357 static_cast< vtkQuaternion<type> > (*this) - \
358 static_cast< vtkQuaternion<type> > (q)).GetData()); \
360 #define vtkQuaternionOperatorMultiply(quaternionType, type) \
361 inline quaternionType operator*(const quaternionType& q) const \
363 return quaternionType( ( \
364 static_cast< vtkQuaternion<type> > (*this) * \
365 static_cast< vtkQuaternion<type> > (q)).GetData()); \
367 #define vtkQuaternionOperatorMultiplyScalar(quaternionType, type) \
368 inline quaternionType operator*(const type& scalar) const \
370 return quaternionType( ( \
371 static_cast< vtkQuaternion<type> > (*this) * \
372 scalar).GetData()); \
374 #define vtkQuaternionOperatorDivide(quaternionType, type) \
375 inline quaternionType operator/(const quaternionType& q) const \
377 return quaternionType( ( \
378 static_cast< vtkQuaternion<type> > (*this) / \
379 static_cast< vtkQuaternion<type> > (q)).GetData()); \
381 #define vtkQuaternionOperatorDivideScalar(quaternionType, type) \
382 inline quaternionType operator/(const type& scalar) const \
384 return quaternionType( ( \
385 static_cast< vtkQuaternion<type> > (*this) / \
386 scalar).GetData()); \
389 #define vtkQuaternionOperatorMacro(quaternionType, type) \
390 vtkQuaternionIdentity(quaternionType, type) \
391 vtkQuaternionNormalized(quaternionType, type) \
392 vtkQuaternionConjugated(quaternionType, type) \
393 vtkQuaternionInverse(quaternionType, type) \
394 vtkQuaternionUnitLog(quaternionType, type) \
395 vtkQuaternionUnitExp(quaternionType, type) \
396 vtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type) \
397 vtkQuaternionSlerp(quaternionType, type) \
398 vtkQuaternionInnerPoint(quaternionType, type) \
399 vtkQuaternionOperatorPlus(quaternionType, type) \
400 vtkQuaternionOperatorMinus(quaternionType, type) \
401 vtkQuaternionOperatorMultiply(quaternionType, type) \
402 vtkQuaternionOperatorMultiplyScalar(quaternionType, type) \
403 vtkQuaternionOperatorDivide(quaternionType, type) \
404 vtkQuaternionOperatorDivideScalar(quaternionType, type)
440 #include "vtkQuaternion.txx"
442 #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.
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)
#define vtkQuaternionOperatorMacro(quaternionType, type)
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