AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::MassProperties Class Reference

Class for rigid body inertia tensor and mass. More...

#include <MassProperties.h>

+ Inheritance diagram for agx::MassProperties:

Public Types

enum  AutoGenerateFlags {
  AUTO_GENERATE_NONE = 0x0 , MASS = 0x1 , CM_OFFSET = 0x2 , INERTIA = 0x4 ,
  AUTO_GENERATE_ALL = MASS | CM_OFFSET | INERTIA
}
 Specifies a bit mask for controlling what should be automatically calculated when a body/geometry is changed. More...
 

Public Member Functions

 MassProperties (agx::Physics::RigidBodyPtr entity)
 Constructor (for internal use) which associates this object to the storage for a RigidBody.
 
virtual ~MassProperties ()
 Destructor.
 
agx::UInt32 getAutoGenerateMask () const
 
const SPDMatrix3x3 & getEffectiveInertiaTensor () const
 
SPDMatrix3x3 getEffectiveInvMassMatrix () const
 
Vec3 getEffectiveInvMassVector () const
 
const Vec3 & getEffectiveMass () const
 
const Vec3 & getEffectiveMassTransformDiagonal () const
 
const SPDMatrix3x3 & getInertiaTensor () const
 
const Vec3 & getInertiaTensorCoefficients () const
 
const Real & getInvMass () const
 
SPDMatrix3x3 getInvMassMatrix () const
 
Vec3 getInvMassVector () const
 
Real getMass () const
 
const Vec3 & getMassCoefficients () const
 
Vec3 getPrincipalInertiae () const
 
MassProperties & operator= (const MassProperties &copy)
 Assignment operator.
 
void setAutoGenerateMask (uint32_t mask)
 Specify which parameters should be automatically calculated from the geometries of the body given a bitmask of AutoGenerateFlags.
 
void setEffectiveMassTransformDiagonal (const Vec3 &effectiveMassTransformDiagonal)
 Set the transform to transform the effective coefficients to the body/mass frame.
 
bool setInertiaTensor (const SPDMatrix3x3 &m, bool autoGenerate=false)
 Set the inertia tensor as a full 3x3 tensor matrix.
 
bool setInertiaTensor (const Vec3 &inertiaDiagonal, bool autoGenerate=false)
 Set the inertia tensor given the diagonal.
 
bool setInertiaTensorCoefficients (const Vec3 &coefficients)
 Set inertia tensor coefficients.
 
bool setMass (Real m, bool autoGenerate=false)
 Set the mass.
 
bool setMassCoefficients (const Vec3 &coefficients)
 Set mass coefficients.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Additional Inherited Members

- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Detailed Description

Class for rigid body inertia tensor and mass.

The mass properties is a combined object which includes the mass and the inertia tensor (in body reference frame).

In some situations the effective mass of the body may differ from the normal mass which can be controlled with the setEffective* methods.

Definition at line 39 of file MassProperties.h.

Member Enumeration Documentation

◆ AutoGenerateFlags

Specifies a bit mask for controlling what should be automatically calculated when a body/geometry is changed.

Enumerator
AUTO_GENERATE_NONE 

Specifies that none of the attributes should be automatically updated.

MASS 

Specifies that the mass should be automatically updated.

CM_OFFSET 

Specifies that the center of mass should be automatically updated.

INERTIA 

Specifies that the inertia should be automatically updated.

AUTO_GENERATE_ALL 

Specifies that the all of the attributes should be automatically updated.

Definition at line 47 of file MassProperties.h.

Constructor & Destructor Documentation

◆ MassProperties()

agx::MassProperties::MassProperties ( agx::Physics::RigidBodyPtr  entity)

Constructor (for internal use) which associates this object to the storage for a RigidBody.

◆ ~MassProperties()

virtual agx::MassProperties::~MassProperties ( )
virtual

Destructor.

Member Function Documentation

◆ getAutoGenerateMask()

agx::UInt32 agx::MassProperties::getAutoGenerateMask ( ) const
inline
Returns
the mask with parameters to be auto-generated.

Definition at line 302 of file MassProperties.h.

◆ getEffectiveInertiaTensor()

const SPDMatrix3x3 & agx::MassProperties::getEffectiveInertiaTensor ( ) const
inline
Returns
the effective inertia matrix. If setInertiaTensorCoefficients==0,0,0, this method will return the same as getInertiaTensor()

Definition at line 313 of file MassProperties.h.

References agxAssert.

◆ getEffectiveInvMassMatrix()

SPDMatrix3x3 agx::MassProperties::getEffectiveInvMassMatrix ( ) const
Returns
the effective inverted mass as a Matrix

◆ getEffectiveInvMassVector()

Vec3 agx::MassProperties::getEffectiveInvMassVector ( ) const
Returns
the effective inverted mass as a Vec3

◆ getEffectiveMass()

const Vec3 & agx::MassProperties::getEffectiveMass ( ) const
inline
Returns
the effective mass

Definition at line 284 of file MassProperties.h.

References agxAssert.

◆ getEffectiveMassTransformDiagonal()

const Vec3 & agx::MassProperties::getEffectiveMassTransformDiagonal ( ) const
inline
Returns
the current transformation for transforming the effective coefficients to the body/mass frame.

Definition at line 319 of file MassProperties.h.

References agxAssert.

◆ getInertiaTensor()

const SPDMatrix3x3 & agx::MassProperties::getInertiaTensor ( ) const
inline
Returns
the inertia tensor.

Definition at line 307 of file MassProperties.h.

References agxAssert.

◆ getInertiaTensorCoefficients()

const Vec3 & agx::MassProperties::getInertiaTensorCoefficients ( ) const
inline
Returns
the current inertia tensor coefficients

Definition at line 296 of file MassProperties.h.

References agxAssert.

◆ getInvMass()

const Real & agx::MassProperties::getInvMass ( ) const
inline
Returns
the inverse mass.

Definition at line 332 of file MassProperties.h.

References agxAssert.

◆ getInvMassMatrix()

SPDMatrix3x3 agx::MassProperties::getInvMassMatrix ( ) const
inline
Returns
the inverse mass matrix.

Definition at line 344 of file MassProperties.h.

References agxAssert.

◆ getInvMassVector()

Vec3 agx::MassProperties::getInvMassVector ( ) const
inline
Returns
the inverse mass vector.

Definition at line 338 of file MassProperties.h.

References agxAssert.

◆ getMass()

Real agx::MassProperties::getMass ( ) const
inline
Returns
the mass.

Definition at line 277 of file MassProperties.h.

References agxAssert.

◆ getMassCoefficients()

const Vec3 & agx::MassProperties::getMassCoefficients ( ) const
inline
Returns
a const reference to the current mass coefficients.

Definition at line 290 of file MassProperties.h.

References agxAssert.

◆ getPrincipalInertiae()

Vec3 agx::MassProperties::getPrincipalInertiae ( ) const
inline
Returns
the diagonal of the inertia matrix

Definition at line 326 of file MassProperties.h.

References agxAssert.

◆ operator=()

MassProperties & agx::MassProperties::operator= ( const MassProperties &  copy)

Assignment operator.

◆ setAutoGenerateMask()

void agx::MassProperties::setAutoGenerateMask ( uint32_t  mask)

Specify which parameters should be automatically calculated from the geometries of the body given a bitmask of AutoGenerateFlags.

Default is AUTO_GENERATE_ALL, which mean that all mass properties are updated whenever a geometry associated to a body is changed/removed/added.

Note
Currently, automatic mass property calculation (incremental or not) assumes all geometries and shapes to be disjoint (non-overlapping). If they overlap, the effect of this assumption is that the overlapping volume will be counted twice into mass and inertia computation. It is recommended to set the mass properties manually in this case.

◆ setEffectiveMassTransformDiagonal()

void agx::MassProperties::setEffectiveMassTransformDiagonal ( const Vec3 &  effectiveMassTransformDiagonal)

Set the transform to transform the effective coefficients to the body/mass frame.

For example if the mass coefficients are given in a left handed body attached frame the effective mass transform should be: 1 0 0 0 -1 0 0 0 1

Note
This transform needs only to be set if there are off diagonal elements in the inertia tensor.

◆ setInertiaTensor() [1/2]

bool agx::MassProperties::setInertiaTensor ( const SPDMatrix3x3 &  m,
bool  autoGenerate = false 
)

Set the inertia tensor as a full 3x3 tensor matrix.

If autoGenerate is set to true, the tensor will be recalculated when the geometry configuration of the body changes.

Parameters
m- The new inertia tensor. Should be a valid finite symmetric positive definite matrix (check its isValid()-method).
autoGenerate- if true, the setAutoGenerateMask will enable the INERTIA update flag.
Return values
Wassetting the inertia tensor valid?

◆ setInertiaTensor() [2/2]

bool agx::MassProperties::setInertiaTensor ( const Vec3 &  inertiaDiagonal,
bool  autoGenerate = false 
)

Set the inertia tensor given the diagonal.

If autoGenerate is set to true, the tensor will be recalculated when the geometry configuration of the body changes.

Parameters
inertiaDiagonal- The new inertia tensor diagonal. Each component has to be > DBL_EPSILON and finite.
autoGenerate- if true, the setAutoGenerateMask will enable the INERTIA update flag.
Return values
Wassetting the inertia tensor valid?

◆ setInertiaTensorCoefficients()

bool agx::MassProperties::setInertiaTensorCoefficients ( const Vec3 &  coefficients)

Set inertia tensor coefficients.

Default is 0,0,0 Side effect: will also update the effective inertia. The inertia tensor coefficients can be used to change the inertia used in the RHS in the solver.

This allows for different inertia for the 3 rotational DOF of a body.

Parameters
coefficientsAll coefficients have to be >= 0 and finite.
Return values
Couldthe coefficients be set successfully?

◆ setMass()

bool agx::MassProperties::setMass ( Real  m,
bool  autoGenerate = false 
)

Set the mass.

This will automatically scale the inertia matrix to reflect the change of mass.

If autoGenerate is set to true, the mass will be recalculated when the geometry configuration of the body changes.

Parameters
m- The new mass. Has to be > DBL_EPSILON and finite.
autoGenerate- if true, the setAutoGenerateMask will enable the MASS update flag.
Return values
Wasthe mass correctly set?

◆ setMassCoefficients()

bool agx::MassProperties::setMassCoefficients ( const Vec3 &  coefficients)

Set mass coefficients.

Default is 0,0,0 Side effect: will also update the effective mass. The mass coefficients can be used to change the mass used in the RHS in the solver. It will not change the gravitational mass.

Parameters
coefficientsAll coefficients have to be >= 0 and finite. This allows for different masses along the 3 translational DOF of a body.
Return values
Couldthe coefficients be set successfully?

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