Utility class to compute and manipulate mass and inertia tensor properties. More...
#include <PxMassProperties.h>
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... | |
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.
|
inline |
Default constructor.
|
inline |
Construct from individual elements.
|
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.
[in] | geometry | The geometry to compute the mass properties for. Supported geometry types are: sphere, box, capsule and convex mesh. |
References PxConvexMeshGeometry::convexMesh, PxMat33::createDiagonal(), PxGeometryType::eBOX, PxGeometryType::eCAPSULE, PxGeometryType::eCONVEXMESH, PxGeometryType::eGEOMETRY_COUNT, PxGeometryType::eHEIGHTFIELD, PxGeometryType::eINVALID, PxGeometryType::ePLANE, PxGeometryType::eSPHERE, PxGeometryType::eTRIANGLEMESH, geometry, PxConvexMesh::getMassInformation(), PxBoxGeometry::halfExtents, PxCapsuleGeometry::halfHeight, PxVec3::multiply(), PX_ASSERT, PxIsFinite(), PxPi, PxSphereGeometry::radius, PxCapsuleGeometry::radius, PxQuat::rotate(), PxQuat::rotateInv(), PxMeshScale::rotation, PxConvexMeshGeometry::scale, PxMeshScale::scale, PxVec3::x, PxVec3::y, and PxVec3::z.
|
inlinestatic |
Get the entries of the diagonalized inertia tensor and the corresponding reference rotation.
[in] | inertia | The inertia tensor to diagonalize. |
[out] | massFrame | The frame the diagonalized tensor refers to. |
References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxQuat::isFinite(), PxVec3::isFinite(), PX_ASSERT, and PxDiagonalize().
|
inline |
Scale mass properties.
[in] | scale | The linear scaling factor to apply to the mass properties. |
References PX_ASSERT, and PxIsFinite().
|
inlinestatic |
Rotate an inertia tensor around the center of mass.
[in] | inertia | The inertia tensor to rotate. |
[in] | q | The rotation to apply to the inertia tensor. |
References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxMat33::getTranspose(), PxVec3::isFinite(), PxQuat::isUnit(), and PX_ASSERT.
|
inlinestatic |
Non-uniform scaling of the inertia tensor.
[in] | inertia | The inertia tensor to scale. |
[in] | scaleRotation | The frame of the provided scaling factors. |
[in] | scale | The scaling factor for each axis (relative to the frame specified in scaleRotation). |
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.
|
inlinestatic |
Sum up individual mass properties.
[in] | props | Array of mass properties to sum up. |
[in] | transforms | Reference transforms for each mass properties entry. |
[in] | count | The number of mass properties to sum up. |
References PxMat33::column0, PxMat33::column1, PxMat33::column2, inertiaTensor, PxVec3::isFinite(), mass, PX_ASSERT, PxIsFinite(), PxZero, and PxTransform::transform().
|
inline |
Translate the center of mass by a given vector and adjust the inertia tensor accordingly.
[in] | t | The translation vector for the center of mass. |
References PxVec3::isFinite(), and PX_ASSERT.
|
inlinestatic |
Translate an inertia tensor using the parallel axis theorem.
[in] | inertia | The inertia tensor to translate. |
[in] | mass | The mass of the object. |
[in] | t | The relative frame to translate the inertia tensor to. |
References PxMat33::column0, PxMat33::column1, PxMat33::column2, PxMat33::getTranspose(), PxVec3::isFinite(), PX_ASSERT, PxIsFinite(), PxVec3::x, PxVec3::y, and PxVec3::z.
PxVec3 PxMassProperties::centerOfMass |
The center of mass of the object.
PxReal PxMassProperties::mass |
The mass of the object.
Referenced by sum().