com.jmex.physics.geometry
Class TriMeshMassProperties

java.lang.Object
  extended by com.jmex.physics.geometry.TriMeshMassProperties

public class TriMeshMassProperties
extends java.lang.Object

Allows to compute the volume, surface, center of mass and the inertia matrix of a TriMesh. This class assumes that the mass is uniformly distributed amoungst the trimesh volume for computing the center of mass and inertia, obviously.

Author:
Thomas Magnaud, Irrisor (ported class from Thomas to jME, thanks Thomas!)
See Also:
TriMeshMassProperties(TriMesh), getVolume(), getCenterOfMass(), getInertia(), getSurface()

Constructor Summary
TriMeshMassProperties(com.jme.scene.TriMesh mesh)
          Create and compute TriMesh properties.
 
Method Summary
 void computeMass()
           
 com.jme.math.Vector3f getCenterOfMass()
           
 com.jme.math.Matrix3f getInertia()
           
 float getSurface()
           
 float getVolume()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TriMeshMassProperties

public TriMeshMassProperties(com.jme.scene.TriMesh mesh)
Create and compute TriMesh properties. The trimeshs world vectors should already be adjusted (especially world scale).

Parameters:
mesh - TriMesh to compute properties for
Method Detail

getInertia

public com.jme.math.Matrix3f getInertia()
Returns:
inertia matrix at (0,0,0) for the trimesh (for uniformly distributed mass in the volume), world coordinates

getCenterOfMass

public com.jme.math.Vector3f getCenterOfMass()
Returns:
center of mass for the trimesh (for uniformly distributed mass in the volume) in world coordinates

getVolume

public float getVolume()
Returns:
volume of the trimesh

getSurface

public float getSurface()
Returns:
surface of the trimesh

computeMass

public void computeMass()