PxMassProperties Class Reference

Utility class to compute and manipulate mass and inertia tensor properties. More...

#include <PxMassProperties.h>

Collaboration diagram for PxMassProperties:

Public Member Functions

PX_FORCE_INLINE PxMassProperties ()
 Default constructor. More...
 
PX_FORCE_INLINE PxMassProperties (const PxReal m, const PxMat33 &inertiaT, const PxVec3 &com)
 Construct from individual elements. More...
 
 PxMassProperties (const PxGeometry &geometry)
 Compute mass properties based on a provided geometry structure. More...
 
PX_FORCE_INLINE PxMassProperties operator* (const PxReal scale) const
 Scale mass properties. More...
 
PX_FORCE_INLINE void translate (const PxVec3 &t)
 Translate the center of mass by a given vector and adjust the inertia tensor accordingly. More...
 

Static Public Member Functions

static PX_FORCE_INLINE PxVec3 getMassSpaceInertia (const PxMat33 &inertia, PxQuat &massFrame)
 Get the entries of the diagonalized inertia tensor and the corresponding reference rotation. More...
 
static PX_FORCE_INLINE PxMat33 translateInertia (const PxMat33 &inertia, const PxReal mass, const PxVec3 &t)
 Translate an inertia tensor using the parallel axis theorem. More...
 
static PX_FORCE_INLINE PxMat33 rotateInertia (const PxMat33 &inertia, const PxQuat &q)
 Rotate an inertia tensor around the center of mass. More...
 
static PxMat33 scaleInertia (const PxMat33 &inertia, const PxQuat &scaleRotation, const PxVec3 &scale)
 Non-uniform scaling of the inertia tensor. More...
 
static PxMassProperties sum (const PxMassProperties *props, const PxTransform *transforms, const PxU32 count)
 Sum up individual mass properties. More...
 

Public Attributes

PxMat33 inertiaTensor
 The inertia tensor of the object. More...
 
PxVec3 centerOfMass
 The center of mass of the object. More...
 
PxReal mass
 The mass of the object. More...
 

Detailed Description

Utility class to compute and manipulate mass and inertia tensor properties.

In most cases PxRigidBodyExt::updateMassAndInertia(), PxRigidBodyExt::setMassAndUpdateInertia() should be enough to setup the mass properties of a rigid body. This utility class targets users that need to customize the mass properties computation.

Constructor & Destructor Documentation

◆ PxMassProperties() [1/3]

PX_FORCE_INLINE PxMassProperties::PxMassProperties ( )
inline

Default constructor.

◆ PxMassProperties() [2/3]

PX_FORCE_INLINE PxMassProperties::PxMassProperties ( const PxReal  m,
const PxMat33 inertiaT,
const PxVec3 com 
)
inline

Construct from individual elements.

◆ PxMassProperties() [3/3]

PxMassProperties::PxMassProperties ( const PxGeometry geometry)
inline

Member Function Documentation

◆ getMassSpaceInertia()

static PX_FORCE_INLINE PxVec3 PxMassProperties::getMassSpaceInertia ( const PxMat33 inertia,
PxQuat massFrame 
)
inlinestatic

Get the entries of the diagonalized inertia tensor and the corresponding reference rotation.

Parameters
[in]inertiaThe inertia tensor to diagonalize.
[out]massFrameThe frame the diagonalized tensor refers to.
Returns
The entries of the diagonalized inertia tensor.

References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxQuat::isFinite(), PxVec3::isFinite(), PX_ASSERT, and PxDiagonalize().

◆ operator*()

PX_FORCE_INLINE PxMassProperties PxMassProperties::operator* ( const PxReal  scale) const
inline

Scale mass properties.

Parameters
[in]scaleThe linear scaling factor to apply to the mass properties.
Returns
The scaled mass properties.

References PX_ASSERT, and PxIsFinite().

◆ rotateInertia()

static PX_FORCE_INLINE PxMat33 PxMassProperties::rotateInertia ( const PxMat33 inertia,
const PxQuat q 
)
inlinestatic

Rotate an inertia tensor around the center of mass.

Parameters
[in]inertiaThe inertia tensor to rotate.
[in]qThe rotation to apply to the inertia tensor.
Returns
The rotated inertia tensor.

References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxMat33::getTranspose(), PxVec3::isFinite(), PxQuat::isUnit(), and PX_ASSERT.

◆ scaleInertia()

static PxMat33 PxMassProperties::scaleInertia ( const PxMat33 inertia,
const PxQuat scaleRotation,
const PxVec3 scale 
)
inlinestatic

Non-uniform scaling of the inertia tensor.

Parameters
[in]inertiaThe inertia tensor to scale.
[in]scaleRotationThe frame of the provided scaling factors.
[in]scaleThe scaling factor for each axis (relative to the frame specified in scaleRotation).
Returns
The scaled inertia tensor.

References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxVec3::dot(), PxQuat::getConjugate(), PxVec3::isFinite(), PxQuat::isUnit(), PxVec3::multiply(), PX_ASSERT, PxVec3::x, PxVec3::y, and PxVec3::z.

◆ sum()

static PxMassProperties PxMassProperties::sum ( const PxMassProperties props,
const PxTransform transforms,
const PxU32  count 
)
inlinestatic

Sum up individual mass properties.

Parameters
[in]propsArray of mass properties to sum up.
[in]transformsReference transforms for each mass properties entry.
[in]countThe number of mass properties to sum up.
Returns
The summed up mass properties.

References PxMat33::column0, PxMat33::column1, PxMat33::column2, inertiaTensor, PxVec3::isFinite(), mass, PX_ASSERT, PxIsFinite(), PxZero, and PxTransform::transform().

◆ translate()

PX_FORCE_INLINE void PxMassProperties::translate ( const PxVec3 t)
inline

Translate the center of mass by a given vector and adjust the inertia tensor accordingly.

Parameters
[in]tThe translation vector for the center of mass.

References PxVec3::isFinite(), and PX_ASSERT.

◆ translateInertia()

static PX_FORCE_INLINE PxMat33 PxMassProperties::translateInertia ( const PxMat33 inertia,
const PxReal  mass,
const PxVec3 t 
)
inlinestatic

Translate an inertia tensor using the parallel axis theorem.

Parameters
[in]inertiaThe inertia tensor to translate.
[in]massThe mass of the object.
[in]tThe relative frame to translate the inertia tensor to.
Returns
The translated inertia tensor.

References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxMat33::getTranspose(), PxVec3::isFinite(), PX_ASSERT, PxIsFinite(), PxVec3::x, PxVec3::y, and PxVec3::z.

Member Data Documentation

◆ centerOfMass

PxVec3 PxMassProperties::centerOfMass

The center of mass of the object.

◆ inertiaTensor

PxMat33 PxMassProperties::inertiaTensor

The inertia tensor of the object.

Referenced by sum().

◆ mass

PxReal PxMassProperties::mass

The mass of the object.

Referenced by sum().


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