PxQuat Class Reference

This is a quaternion class. For more information on quaternion mathematics consult a mathematics source on complex numbers. More...

#include <PxQuat.h>

Public Member Functions

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat ()
 Default constructor, does not do any initialization. More...
 
PX_CUDA_CALLABLE PX_INLINE PxQuat (PxIDENTITY r)
 identity constructor More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat (float r)
 Constructor from a scalar: sets the real part w to the scalar value, and the imaginary parts (x,y,z) to zero. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat (float nx, float ny, float nz, float nw)
 Constructor. Take note of the order of the elements! More...
 
PX_CUDA_CALLABLE PX_INLINE PxQuat (float angleRadians, const PxVec3 &unitAxis)
 Creates from angle-axis representation. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat (const PxQuat &v)
 Copy ctor. More...
 
PX_CUDA_CALLABLE PX_INLINE PxQuat (const PxMat33 &m)
 Creates from orientation matrix. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isIdentity () const
 returns true if quat is identity More...
 
PX_CUDA_CALLABLE bool isFinite () const
 returns true if all elements are finite (not NAN or INF, etc.) More...
 
PX_CUDA_CALLABLE bool isUnit () const
 returns true if finite and magnitude is close to unit More...
 
PX_CUDA_CALLABLE bool isSane () const
 returns true if finite and magnitude is reasonably close to unit to allow for some accumulation of error vs isValid More...
 
PX_CUDA_CALLABLE PX_INLINE bool operator== (const PxQuat &q) const
 returns true if the two quaternions are exactly equal More...
 
PX_CUDA_CALLABLE PX_INLINE void toRadiansAndUnitAxis (float &angle, PxVec3 &axis) const
 converts this quaternion to angle-axis representation More...
 
PX_CUDA_CALLABLE PX_INLINE float getAngle () const
 Gets the angle between this quat and the identity quaternion. More...
 
PX_CUDA_CALLABLE PX_INLINE float getAngle (const PxQuat &q) const
 Gets the angle between this quat and the argument. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared () const
 This is the squared 4D vector length, should be 1 for unit quaternions. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE float dot (const PxQuat &v) const
 returns the scalar product of this and other. More...
 
PX_CUDA_CALLABLE PX_INLINE PxQuat getNormalized () const
 
PX_CUDA_CALLABLE PX_INLINE float magnitude () const
 
PX_CUDA_CALLABLE PX_INLINE float normalize ()
 maps to the closest unit quaternion. More...
 
PX_CUDA_CALLABLE PX_INLINE PxQuat getConjugate () const
 
PX_CUDA_CALLABLE PX_INLINE PxVec3 getImaginaryPart () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector0 () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector1 () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector2 () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 rotate (const PxVec3 &v) const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 rotateInv (const PxVec3 &v) const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatoperator= (const PxQuat &p)
 Assignment operator. More...
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatoperator*= (const PxQuat &q)
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatoperator+= (const PxQuat &q)
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatoperator-= (const PxQuat &q)
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuatoperator*= (const float s)
 
PX_CUDA_CALLABLE PX_INLINE PxQuat operator* (const PxQuat &q) const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator+ (const PxQuat &q) const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator- () const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator- (const PxQuat &q) const
 
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator* (float r) const
 

Public Attributes

float x
 
float y
 
float z
 
float w
 

Detailed Description

This is a quaternion class. For more information on quaternion mathematics consult a mathematics source on complex numbers.

Constructor & Destructor Documentation

◆ PxQuat() [1/6]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat::PxQuat ( )
inline

Default constructor, does not do any initialization.

◆ PxQuat() [2/6]

PX_CUDA_CALLABLE PX_INLINE PxQuat::PxQuat ( PxIDENTITY  r)
inline

identity constructor

References PX_UNUSED().

◆ PxQuat() [3/6]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat::PxQuat ( float  r)
inlineexplicit

Constructor from a scalar: sets the real part w to the scalar value, and the imaginary parts (x,y,z) to zero.

◆ PxQuat() [4/6]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat::PxQuat ( float  nx,
float  ny,
float  nz,
float  nw 
)
inline

Constructor. Take note of the order of the elements!

◆ PxQuat() [5/6]

PX_CUDA_CALLABLE PX_INLINE PxQuat::PxQuat ( float  angleRadians,
const PxVec3 unitAxis 
)
inline

Creates from angle-axis representation.

Axis must be normalized!

Angle is in radians!

Unit: Radians

References PxVec3::magnitude(), PX_SHARED_ASSERT, PxAbs(), PxCos(), PxSin(), PxVec3::x, PxVec3::y, and PxVec3::z.

◆ PxQuat() [6/6]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat::PxQuat ( const PxQuat v)
inline

Copy ctor.

Member Function Documentation

◆ dot()

PX_CUDA_CALLABLE PX_FORCE_INLINE float PxQuat::dot ( const PxQuat v) const
inline

returns the scalar product of this and other.

References w, x, y, and z.

◆ getAngle() [1/2]

PX_CUDA_CALLABLE PX_INLINE float PxQuat::getAngle ( ) const
inline

Gets the angle between this quat and the identity quaternion.

Unit: Radians

References PxAcos().

◆ getAngle() [2/2]

PX_CUDA_CALLABLE PX_INLINE float PxQuat::getAngle ( const PxQuat q) const
inline

Gets the angle between this quat and the argument.

Unit: Radians

References PxAcos().

◆ getBasisVector0()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxQuat::getBasisVector0 ( ) const
inline

brief computes rotation of x-axis

◆ getBasisVector1()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxQuat::getBasisVector1 ( ) const
inline

brief computes rotation of y-axis

◆ getBasisVector2()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxQuat::getBasisVector2 ( ) const
inline

brief computes rotation of z-axis

◆ getConjugate()

◆ getImaginaryPart()

PX_CUDA_CALLABLE PX_INLINE PxVec3 PxQuat::getImaginaryPart ( ) const
inline

◆ getNormalized()

PX_CUDA_CALLABLE PX_INLINE PxQuat PxQuat::getNormalized ( ) const
inline

◆ isFinite()

PX_CUDA_CALLABLE bool PxQuat::isFinite ( ) const
inline

returns true if all elements are finite (not NAN or INF, etc.)

References PxIsFinite().

Referenced by PxMassProperties::getMassSpaceInertia(), PxTransform::isFinite(), and PxTransform::isValid().

◆ isIdentity()

PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxQuat::isIdentity ( ) const
inline

returns true if quat is identity

◆ isSane()

PX_CUDA_CALLABLE bool PxQuat::isSane ( ) const
inline

returns true if finite and magnitude is reasonably close to unit to allow for some accumulation of error vs isValid

References physx::intrinsics::isFinite(), and PxAbs().

Referenced by PxTransform::isSane(), and PxTransform::PxTransform().

◆ isUnit()

PX_CUDA_CALLABLE bool PxQuat::isUnit ( ) const
inline

returns true if finite and magnitude is close to unit

References physx::intrinsics::isFinite(), and PxAbs().

Referenced by PxTransform::isValid(), PxMeshScale::PxMeshScale(), PxMassProperties::rotateInertia(), and PxMassProperties::scaleInertia().

◆ magnitude()

PX_CUDA_CALLABLE PX_INLINE float PxQuat::magnitude ( ) const
inline

References PxSqrt().

◆ magnitudeSquared()

PX_CUDA_CALLABLE PX_FORCE_INLINE float PxQuat::magnitudeSquared ( ) const
inline

This is the squared 4D vector length, should be 1 for unit quaternions.

◆ normalize()

PX_CUDA_CALLABLE PX_INLINE float PxQuat::normalize ( )
inline

maps to the closest unit quaternion.

◆ operator*() [1/2]

PX_CUDA_CALLABLE PX_INLINE PxQuat PxQuat::operator* ( const PxQuat q) const
inline

quaternion multiplication

References w, x, y, and z.

◆ operator*() [2/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxQuat::operator* ( float  r) const
inline

◆ operator*=() [1/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& PxQuat::operator*= ( const PxQuat q)
inline

References w, x, y, and z.

◆ operator*=() [2/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& PxQuat::operator*= ( const float  s)
inline

◆ operator+()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxQuat::operator+ ( const PxQuat q) const
inline

quaternion addition

References w, x, y, and z.

◆ operator+=()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& PxQuat::operator+= ( const PxQuat q)
inline

References w, x, y, and z.

◆ operator-() [1/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxQuat::operator- ( ) const
inline

quaternion subtraction

◆ operator-() [2/2]

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxQuat::operator- ( const PxQuat q) const
inline

References w, x, y, and z.

◆ operator-=()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& PxQuat::operator-= ( const PxQuat q)
inline

References w, x, y, and z.

◆ operator=()

PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& PxQuat::operator= ( const PxQuat p)
inline

Assignment operator.

References w, x, y, and z.

◆ operator==()

PX_CUDA_CALLABLE PX_INLINE bool PxQuat::operator== ( const PxQuat q) const
inline

returns true if the two quaternions are exactly equal

References w, x, y, and z.

◆ rotate()

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 PxQuat::rotate ( const PxVec3 v) const
inline

rotates passed vec by this (assumed unitary)

References PxVec3::x, PxVec3::y, and PxVec3::z.

Referenced by PxMassProperties::PxMassProperties(), PxTransform::rotate(), PxTransform::transform(), and PxTransform::transformInv().

◆ rotateInv()

PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 PxQuat::rotateInv ( const PxVec3 v) const
inline

inverse rotates passed vec by this (assumed unitary)

References PxVec3::x, PxVec3::y, and PxVec3::z.

Referenced by PxTransform::getInverse(), PxMassProperties::PxMassProperties(), PxTransform::rotateInv(), and PxTransform::transformInv().

◆ toRadiansAndUnitAxis()

PX_CUDA_CALLABLE PX_INLINE void PxQuat::toRadiansAndUnitAxis ( float &  angle,
PxVec3 axis 
) const
inline

converts this quaternion to angle-axis representation

References PxAbs(), PxAtan2(), PxPi, and PxRecipSqrt().

Member Data Documentation

◆ w

◆ x

◆ y

◆ z


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