net.java.dev.joode
Class Mass

java.lang.Object
  extended by net.java.dev.joode.Mass
All Implemented Interfaces:
java.io.Serializable, SimState

public class Mass
extends java.lang.Object
implements SimState

The mass parameters of a rigid body

Author:
Tom Larkworthy, Mark McKay , Harald Dietrich
See Also:
Serialized Form

Field Summary
static boolean DEBUG
           
 Matrix3 invI
          inverse matrix of moment of inertia
NEVER USE THIS TO MODIFY THE MASS OF A BODY
 float invMass
          inverse of total mass
NEVER USE THIS TO MODIFY THE MASS OF A BODY
 float mass
          total mass
NEVER USE THIS TO MODIFY THE MASS OF A BODY
 Matrix3 momentOfInertia
          3x3 inertia tensor in body frame, about POR
NEVER USE THIS TO MODIFY THE MASS OF A BODY
 
Method Summary
 void add(Mass b)
          Add the passed mass to this mass.
 void adjust(float newmass)
          Given mass parameters for some object, adjust them so the total mass is now newmass.
 boolean checkMass()
          Checks whether this Mass has consistent properties.
 Mass cloneState(ClonedReferences util)
           deep clones the state object, any references to other SimState objects should be cloned and assigned to the clone via the ClonedReferences util object.
static Mass create(float themass, float cgx, float cgy, float cgz, float I11, float I22, float I33, float I12, float I13, float I23)
          Set the mass parameters to the given values.
static Mass createBox(float density, float lx, float ly, float lz)
          Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body.
static Mass createBoxTotal(float total_mass, float lx, float ly, float lz)
          Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body.
static Mass createBoxTotal(float total_mass, Vector3 l)
           
static Mass createCapsule(float density, int direction, float radius, float length)
          Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
static Mass createCapsuleTotal(float total_mass, int direction, float radius, float length)
          Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
static Mass createCylinder(float density, int direction, float radius, float length)
          Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
static Mass createCylinderHollowTotal(float total_mass, int direction, float radius, float length)
          Sets mass properties to that of a cylinder with all of it's mass distributed evenly along it's shell.
static Mass createCylinderTotal(float total_mass, int direction, float radius, float length)
          Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
static Mass createSphere(float density, float radius)
          Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.
static Mass createSphereHollowTotal(float total_mass, float radius)
          Sets mass and inertial tensor to that of a sphere with all of it's mass distributed evenly on it's shell.
static Mass createSphereTotal(float total_mass, float radius)
          Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.
 void rotate(Matrix3 R)
          Given mass parameters for some object, adjust them to represent the object rotated by R relative to the body frame.
 void translate(float x, float y, float z)
          Given mass parameters for some object, adjust them to represent the object displaced by (x,y,z) relative to the body frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

mass

public float mass
total mass
NEVER USE THIS TO MODIFY THE MASS OF A BODY


invMass

public float invMass
inverse of total mass
NEVER USE THIS TO MODIFY THE MASS OF A BODY


momentOfInertia

public final Matrix3 momentOfInertia
3x3 inertia tensor in body frame, about POR
NEVER USE THIS TO MODIFY THE MASS OF A BODY


invI

public final Matrix3 invI
inverse matrix of moment of inertia
NEVER USE THIS TO MODIFY THE MASS OF A BODY

Method Detail

checkMass

public boolean checkMass()
Checks whether this Mass has consistent properties.

Returns:
true if ok, false if the mass is faulty

create

public static Mass create(float themass,
                          float cgx,
                          float cgy,
                          float cgz,
                          float I11,
                          float I22,
                          float I33,
                          float I12,
                          float I13,
                          float I23)
Set the mass parameters to the given values. themass is the mass of the body. (cx,cy,cz) is the center of gravity position in the body frame. The Ixx values are the elements of the inertia matrix:


createSphere

public static Mass createSphere(float density,
                                float radius)
Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body. Accepts the density of the sphere.


createSphereTotal

public static Mass createSphereTotal(float total_mass,
                                     float radius)
Set the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body. Accepts the total mass of the sphere.


createSphereHollowTotal

public static Mass createSphereHollowTotal(float total_mass,
                                           float radius)
Sets mass and inertial tensor to that of a sphere with all of it's mass distributed evenly on it's shell.


createCapsule

public static Mass createCapsule(float density,
                                 int direction,
                                 float radius,
                                 float length)
Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder (and the spherical cap) is radius. The length of the cylinder (not counting the spherical cap) is length. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (0=x, 1=y, 2=z). Accepts the density of the object.


createCapsuleTotal

public static Mass createCapsuleTotal(float total_mass,
                                      int direction,
                                      float radius,
                                      float length)
Set the mass parameters to represent a capped cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder (and the spherical cap) is radius. The length of the cylinder (not counting the spherical cap) is length. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (0=x, 1=y, 2=z). Accepts total mass of the object.


createCylinder

public static Mass createCylinder(float density,
                                  int direction,
                                  float radius,
                                  float length)
Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder is radius. The length of the cylinder is length. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (1=x, 2=y, 3=z). Accepts the density of the object.


createCylinderTotal

public static Mass createCylinderTotal(float total_mass,
                                       int direction,
                                       float radius,
                                       float length)
Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body. The radius of the cylinder is radius. The length of the cylinder is length. The cylinder's long axis is oriented along the body's x, y or z axis according to the value of direction (0=x, 1=y, 2=z). Accepts its total mass.


createCylinderHollowTotal

public static Mass createCylinderHollowTotal(float total_mass,
                                             int direction,
                                             float radius,
                                             float length)
Sets mass properties to that of a cylinder with all of it's mass distributed evenly along it's shell.


createBox

public static Mass createBox(float density,
                             float lx,
                             float ly,
                             float lz)
Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body. The side lengths of the box along the x, y and z axes are lx, ly and lz. Accepts the density of the object.


createBoxTotal

public static Mass createBoxTotal(float total_mass,
                                  float lx,
                                  float ly,
                                  float lz)
Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body. The side lengths of the box along the x, y and z axes are lx, ly and lz. Accepts its total mass.


createBoxTotal

public static Mass createBoxTotal(float total_mass,
                                  Vector3 l)

adjust

public void adjust(float newmass)
Given mass parameters for some object, adjust them so the total mass is now newmass. This is useful when using the above functions to set the mass parameters for certain objects - they take the object density, not the total mass.


translate

public void translate(float x,
                      float y,
                      float z)
Given mass parameters for some object, adjust them to represent the object displaced by (x,y,z) relative to the body frame.


rotate

public void rotate(Matrix3 R)
Given mass parameters for some object, adjust them to represent the object rotated by R relative to the body frame.


add

public void add(Mass b)
Add the passed mass to this mass.


cloneState

public Mass cloneState(ClonedReferences util)
Description copied from interface: SimState

deep clones the state object, any references to other SimState objects should be cloned and assigned to the clone via the ClonedReferences util object. The util object ensures that multiple clones of the same object are not performed during a clone operation.

Specified by:
cloneState in interface SimState
Parameters:
util - instanciate a new one if top level cloning