RavEngine
Loading...
Searching...
No Matches
physx::PxMassProperties Class Reference

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

#include <PxMassProperties.h>

Collaboration diagram for physx::PxMassProperties:
[legend]

Public Member Functions

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

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.
 
static PX_FORCE_INLINE PxMat33 translateInertia (const PxMat33 &inertia, const PxReal mass, const PxVec3 &t)
 Translate an inertia tensor using the parallel axis theorem.
 
static PX_FORCE_INLINE PxMat33 rotateInertia (const PxMat33 &inertia, const PxQuat &q)
 Rotate an inertia tensor around the center of mass.
 
static PxMat33 scaleInertia (const PxMat33 &inertia, const PxQuat &scaleRotation, const PxVec3 &scale)
 Non-uniform scaling of the inertia tensor.
 
static PxMassProperties sum (const PxMassProperties *props, const PxTransform *transforms, const PxU32 count)
 Sum up individual mass properties.
 

Public Attributes

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

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()

physx::PxMassProperties::PxMassProperties ( const PxGeometry &  geometry)
inline

Compute mass properties based on a provided geometry structure.

This constructor assumes the geometry has a density of 1. Mass and inertia tensor scale linearly with density.

Parameters
[in]geometryThe geometry to compute the mass properties for. Supported geometry types are: sphere, box, capsule and convex mesh.

Member Function Documentation

◆ getMassSpaceInertia()

static PX_FORCE_INLINE PxVec3 physx::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.

◆ operator*()

PX_FORCE_INLINE PxMassProperties physx::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.

◆ rotateInertia()

static PX_FORCE_INLINE PxMat33 physx::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 from the new to the old coordinate frame, i.e. q.rotate(v) transforms the coordinates of vector v from the old to the new coordinate frame.
Returns
The rotated inertia tensor.

◆ scaleInertia()

static PxMat33 physx::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 rotation from the scaling frame to the frame that inertia is expressed in. I.e. scaleRotation.rotate(v) transforms the coordinates of vertex v from inertia's frame to the scaling-axes frame.
[in]scaleThe scaling factor for each axis (relative to the frame specified with scaleRotation).
Returns
The scaled inertia tensor.

◆ sum()

static PxMassProperties physx::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.

◆ translate()

PX_FORCE_INLINE void physx::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.

◆ translateInertia()

static PX_FORCE_INLINE PxMat33 physx::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.

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