Jolt Physics
A multi core friendly Game Physics Engine
|
Describes the mass and inertia properties of a body. Used during body construction only. More...
#include <MassProperties.h>
Public Member Functions | |
bool | DecomposePrincipalMomentsOfInertia (Mat44 &outRotation, Vec3 &outDiagonal) const |
void | SetMassAndInertiaOfSolidBox (Vec3Arg inBoxSize, float inDensity) |
Set the mass and inertia of a box with edge size inBoxSize and density inDensity. | |
void | ScaleToMass (float inMass) |
Set the mass and scale the inertia tensor to match the mass. | |
void | Rotate (Mat44Arg inRotation) |
Rotate the inertia by 3x3 matrix inRotation. | |
void | Translate (Vec3Arg inTranslation) |
Translate the inertia by a vector inTranslation. | |
void | Scale (Vec3Arg inScale) |
Scale the mass and inertia by inScale, note that elements can be < 0 to flip the shape. | |
void | SaveBinaryState (StreamOut &inStream) const |
Saves the state of this object in binary form to inStream. | |
void | RestoreBinaryState (StreamIn &inStream) |
Restore the state of this object from inStream. | |
Static Public Member Functions | |
static Vec3 | sGetEquivalentSolidBoxSize (float inMass, Vec3Arg inInertiaDiagonal) |
Calculates the size of the solid box that has an inertia tensor diagonal inInertiaDiagonal. | |
Public Attributes | |
float | mMass = 0.0f |
Mass of the shape (kg) | |
Mat44 | mInertia = Mat44::sZero() |
Inertia tensor of the shape (kg m^2) | |
Describes the mass and inertia properties of a body. Used during body construction only.
bool MassProperties::DecomposePrincipalMomentsOfInertia | ( | Mat44 & | outRotation, |
Vec3 & | outDiagonal | ||
) | const |
Using eigendecomposition, decompose the inertia tensor into a diagonal matrix D and a right-handed rotation matrix R so that the inertia tensor is \(R \: D \: R^{-1}\).
outRotation | The rotation matrix R |
outDiagonal | The diagonal of the diagonal matrix D |
void MassProperties::RestoreBinaryState | ( | StreamIn & | inStream | ) |
Restore the state of this object from inStream.
void MassProperties::Rotate | ( | Mat44Arg | inRotation | ) |
Rotate the inertia by 3x3 matrix inRotation.
void MassProperties::SaveBinaryState | ( | StreamOut & | inStream | ) | const |
Saves the state of this object in binary form to inStream.
void MassProperties::Scale | ( | Vec3Arg | inScale | ) |
Scale the mass and inertia by inScale, note that elements can be < 0 to flip the shape.
void MassProperties::ScaleToMass | ( | float | inMass | ) |
Set the mass and scale the inertia tensor to match the mass.
void MassProperties::SetMassAndInertiaOfSolidBox | ( | Vec3Arg | inBoxSize, |
float | inDensity | ||
) |
Set the mass and inertia of a box with edge size inBoxSize and density inDensity.
Calculates the size of the solid box that has an inertia tensor diagonal inInertiaDiagonal.
void MassProperties::Translate | ( | Vec3Arg | inTranslation | ) |
Translate the inertia by a vector inTranslation.
Mat44 MassProperties::mInertia = Mat44::sZero() |
Inertia tensor of the shape (kg m^2)
float MassProperties::mMass = 0.0f |
Mass of the shape (kg)