$darkmode
VCG Library
Public Member Functions | Static Public Member Functions | List of all members
vcg::tri::Inertia< MeshType > Class Template Reference

Methods for computing Polyhedral Mass properties (like inertia tensor, volume, etc) More...

#include <inertia.h>

Public Member Functions

 Inertia (const MeshType &m)
 Basic constructor. More...
 
void compProjectionIntegrals (const FaceType &f)
 
void CompFaceIntegrals (const FaceType &f, const Point3< ScalarType > &n)
 
void Compute (const MeshType &m)
 
ScalarType Mass (void) const
 Return the Volume (or mass) of the mesh. More...
 
Point3< ScalarType > CenterOfMass (void) const
 Return the Center of Mass (or barycenter) of the mesh. More...
 
void InertiaTensor (Matrix33< ScalarType > &J) const
 
void InertiaTensor (Eigen::Matrix3d &J) const
 
void InertiaTensorEigen (Matrix33< ScalarType > &EV, Point3< ScalarType > &ev) const
 Return the Inertia tensor the mesh. More...
 

Static Public Member Functions

static void Covariance (const MeshType &m, vcg::Point3< ScalarType > &bary, vcg::Matrix33< ScalarType > &C)
 

Detailed Description

template<class MeshType>
class vcg::tri::Inertia< MeshType >

Methods for computing Polyhedral Mass properties (like inertia tensor, volume, etc)

The algorithm is based on a three step reduction of the volume integrals to successively simpler integrals. The algorithm is designed to minimize the numerical errors that can result from poorly conditioned alignment of polyhedral faces. It is also designed for efficiency. All required volume integrals of a polyhedron are computed together during a single walk over the boundary of the polyhedron; exploiting common subexpressions reduces floating point operations.

For more information, check out:

Brian Mirtich, `‘Fast and Accurate Computation of Polyhedral Mass Properties,’' journal of graphics tools, volume 1, number 2, 1996

Constructor & Destructor Documentation

◆ Inertia()

template<class MeshType >
vcg::tri::Inertia< MeshType >::Inertia ( const MeshType &  m)
inline

Basic constructor.

When you create a Inertia object, you have to specify the mesh that it refers to. The properties are computed at that moment. Subsequent modification of the mesh does not affect these values.

Member Function Documentation

◆ CenterOfMass()

template<class MeshType >
Point3<ScalarType> vcg::tri::Inertia< MeshType >::CenterOfMass ( void  ) const
inline

Return the Center of Mass (or barycenter) of the mesh.

Meaningful only if the mesh is watertight.

◆ Compute()

template<class MeshType >
void vcg::tri::Inertia< MeshType >::Compute ( const MeshType &  m)
inline

main function to be called.

It requires a watertight mesh with per face normals.

◆ Covariance()

template<class MeshType >
static void vcg::tri::Inertia< MeshType >::Covariance ( const MeshType &  m,
vcg::Point3< ScalarType > &  bary,
vcg::Matrix33< ScalarType > &  C 
)
inlinestatic

Compute covariance matrix of a mesh, i.e. the integral int_{M} { (x-b)(x-b)^T }dx where b is the barycenter and x spans over the mesh M

◆ InertiaTensorEigen()

template<class MeshType >
void vcg::tri::Inertia< MeshType >::InertiaTensorEigen ( Matrix33< ScalarType > &  EV,
Point3< ScalarType > &  ev 
) const
inline

Return the Inertia tensor the mesh.

The result is factored as eigenvalues and eigenvectors (as ROWS).

◆ Mass()

template<class MeshType >
ScalarType vcg::tri::Inertia< MeshType >::Mass ( void  ) const
inline

Return the Volume (or mass) of the mesh.

Meaningful only if the mesh is watertight.


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