 VCG Library
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 (MeshType &m)
Basic constructor.

void Compute (MeshType &m)

ScalarType Mass ()
Return the Volume (or mass) of the mesh.

Point3< ScalarType > CenterOfMass ()
Return the Center of Mass (or barycenter) of the mesh.

void InertiaTensorEigen (Matrix33< ScalarType > &EV, Point3< ScalarType > &ev)
Return the Inertia tensor the mesh.

## 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.

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

Definition at line 54 of file inertia.h.

## Constructor & Destructor Documentation

template<class MeshType>
 vcg::tri::Inertia< MeshType >::Inertia ( 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.

Definition at line 91 of file inertia.h.

## Member Function Documentation

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

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

Meaningful only if the mesh is watertight.

Definition at line 244 of file inertia.h.

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

main function to be called.

It requires a watertight mesh with per face normals.

Definition at line 191 of file inertia.h.

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

Definition at line 318 of file inertia.h.

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

Return the Inertia tensor the mesh.

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

Definition at line 303 of file inertia.h.

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

Return the Volume (or mass) of the mesh.

Meaningful only if the mesh is watertight.

Definition at line 235 of file inertia.h.

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