Visual Computing Library
|
The MeshInertia class provides several for computing Polyhedral Mass properties (like inertia tensor, volume, etc). More...
#include <vclib/space/complex/mesh_inertia.h>
Public Member Functions | |
MeshInertia (const MeshType &m) | |
ScalarType | volume () const |
Returns the volume (or mass) of the mesh. Meaningful only if the mesh is watertight. | |
Point3< ScalarType > | centerOfMass () const |
template<typename Matrix33 > | |
Matrix33 | inertiaTensor () const |
template<typename Matrix33 > | |
void | inertiaTensorEigen (Matrix33 &eigenValues, Point3< ScalarType > &eigenVector) const |
Computes the inertia tensor mesh. | |
Private Types | |
enum | { X = 0 , Y = 1 , Z = 2 } |
using | VertexType = MeshType::VertexType |
using | FaceType = MeshType::FaceType |
using | ScalarType = VertexType::CoordType::ScalarType |
Private Member Functions | |
void | faceIntegrals (const FaceType &f, const Point3< ScalarType > &n) |
void | projectionIntegrals (const FaceType &f) |
Computes various integrations over projection of the given face. | |
Static Private Member Functions | |
static ScalarType | sqr (const ScalarType &x) |
static ScalarType | cube (const ScalarType &x) |
Private Attributes | |
int | mA |
int | mB |
int | mC |
double | mP1 |
double | mPa |
double | mPb |
double | mPaa |
double | mPab |
double | mPbb |
double | mPaaa |
double | mPaab |
double | mPabb |
double | mPbbb |
double | mFa |
double | mFb |
double | mFc |
double | mFaa |
double | mFbb |
double | mFcc |
double | mFaaa |
double | mFbbb |
double | mFccc |
double | mFaab |
double | mFbbc |
double | mFcca |
double | mT0 = 0 |
double | mT1 [3] = {0, 0, 0} |
double | mT2 [3] = {0, 0, 0} |
double | mTP [3] = {0, 0, 0} |
The MeshInertia class provides several 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
|
inline |
Computes the inertia tensor mesh.
The result is factored as eigenvalues and eigenvectors (as ROWS).
[out] | eigenValues | |
[out] | eigenVector |
|
inlineprivate |
Computes various integrations over projection of the given face.
f |
|
inline |
Returns the volume (or mass) of the mesh. Meaningful only if the mesh is watertight.