net.java.dev.joode
Class Body

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

public class Body
extends WorldObject

Bodies are the most important objects that reside within a World container. Bodies have position, rotation, velocity, angular velocity and mass, and are influenced by forces.

Bodies DO NOT inherently have a shape. A shape is formed by adding geometries to a body. However, geometry and collisions are handled by space containers. World and Space concepts are independant. You can use bodies without spaces or geometries.

Author:
Tom Larkworthy, Harald Dietrich
See Also:
World, Serialized Form

Field Summary
 Vector3 avel
          angular velocity
static int dxBodyAutoDisable
          denotes that the body should be auto-disabled
static int dxBodyDisabled
          denotes that the body is disabled
static int dxBodyFlagFiniteRotation
          denotes that the body should use finite rotations, denotes the meaning of angular velocity if using finite rotations, the length of the angular velocity vector denotes the theta velocity otherwise
static int dxBodyFlagFiniteRotationAxis
          denotes that the body should us finite rotation around a single axis
static int dxBodyGravity
          denotes that the body should be affected by gravity
static int dxBodyNoForce
          denotes that the body cannot be affected by external forces (implementers of Force)
 Vector3 facc
          linear force accumulator
 Vector3 finite_rot_axis
          finite rotation axis, unit length or 0=none
 int flags
          body flags, defined by dxBodyFlagXXX constants
 Geom geom
          first collision geom associated with body
 java.util.List<Geom> geoms
          all geoms associated with body
 java.util.List<Joint> joints
          attached joints
 Vector3 lvel
          linear velocity
 Mass mass
          mass parameters about POR
 Vector3 pos
          position of POR (point of reference)
 PosR posR
          single object reference for both position and rotation of the body
 Quaternion q
          orientation quaternion, must correspond to R
 Matrix3 R
          rotation matrix, must correspond to q
 Vector3 tacc
          torque accumulator
 
Fields inherited from class net.java.dev.joode.WorldObject
data, tag, world
 
Constructor Summary
Body(World world, Mass mass)
           
 
Method Summary
 void addForce(float fx, float fy, float fz)
           
 void addForceAtPos(float fx, float fy, float fz, float px, float py, float pz)
           
 void addForceAtRelPos(float fx, float fy, float fz, float px, float py, float pz)
           
 void addGeom(Geom g)
           
 void addRelForce(float fx, float fy, float fz)
           
 void addRelForceAtPos(float fx, float fy, float fz, float px, float py, float pz)
           
 void addRelForceAtRelPos(float fx, float fy, float fz, float px, float py, float pz)
           
 void addRelTorque(float fx, float fy, float fz)
           
 void addTorque(float fx, float fy, float fz)
           
 Body 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.
 void destroy()
           
 void disable()
           
 void enable()
           
 void getAngularVel(Vector3f v)
           
 void getAngularVelocityToTurn(Quaternion dq, float fps, Vector3 angularPassback)
           calculates what the angular velocity should be set to, for the body to change orientation by the amount specified by the quaternion argument over the time 1/fps
 void getForce(Vector3f v)
           
 Geom getGeom()
          Convention method, makes Joode like Odejava
 void getLinearVel(Vector3f v)
           
 void getTorque(Vector3f v)
           
 boolean isAutoDisabled()
           
 boolean isEnabled()
           
 boolean isFiniteRotations()
           
 void resetForces()
           
 void setAngularVel(float fx, float fy, float fz)
           
 void setAutoDisable(boolean e)
           
 void setEnabled(boolean e)
           
 void setFiniteRotations(boolean b)
          sets the body flag to use finite rotations This is the more accurate method for stepping the body, where rotations are not assumed to be infintesimaly small
 void setGravityMode(boolean m)
           
 void setLinearVel(float fx, float fy, float fz)
           
 void setPosition(float x, float y, float z)
           
 void setRotation(float a, float b, float c, float w)
           
 void setRotation(Matrix3 R)
           
 void setRotation(Quaternion q)
           
 void setStepDisableThreshold(int i)
           
 void step(float h)
          apply the linear and angular velocities over time interval h, thereby adjusting its position and orientation.
 
Methods inherited from class net.java.dev.joode.WorldObject
partialCloneWorldObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

joints

public java.util.List<Joint> joints
attached joints


flags

public int flags
body flags, defined by dxBodyFlagXXX constants


geom

public Geom geom
first collision geom associated with body


geoms

public java.util.List<Geom> geoms
all geoms associated with body


mass

public final Mass mass
mass parameters about POR


pos

public final Vector3 pos
position of POR (point of reference)


q

public final Quaternion q
orientation quaternion, must correspond to R


R

public final Matrix3 R
rotation matrix, must correspond to q


lvel

public final Vector3 lvel
linear velocity


avel

public final Vector3 avel
angular velocity


facc

public final Vector3 facc
linear force accumulator


tacc

public final Vector3 tacc
torque accumulator


finite_rot_axis

public final Vector3 finite_rot_axis
finite rotation axis, unit length or 0=none


posR

public final PosR posR
single object reference for both position and rotation of the body


dxBodyFlagFiniteRotation

public static final int dxBodyFlagFiniteRotation
denotes that the body should use finite rotations, denotes the meaning of angular velocity if using finite rotations, the length of the angular velocity vector denotes the theta velocity otherwise

See Also:
Constant Field Values

dxBodyFlagFiniteRotationAxis

public static final int dxBodyFlagFiniteRotationAxis
denotes that the body should us finite rotation around a single axis

See Also:
Constant Field Values

dxBodyDisabled

public static final int dxBodyDisabled
denotes that the body is disabled

See Also:
Constant Field Values

dxBodyNoForce

public static final int dxBodyNoForce
denotes that the body cannot be affected by external forces (implementers of Force)

See Also:
Constant Field Values

dxBodyAutoDisable

public static final int dxBodyAutoDisable
denotes that the body should be auto-disabled

See Also:
Constant Field Values

dxBodyGravity

public static final int dxBodyGravity
denotes that the body should be affected by gravity

See Also:
Constant Field Values
Constructor Detail

Body

public Body(World world,
            Mass mass)
Method Detail

destroy

public void destroy()
Specified by:
destroy in class WorldObject

setPosition

public void setPosition(float x,
                        float y,
                        float z)

setRotation

public void setRotation(Matrix3 R)

setRotation

public void setRotation(float a,
                        float b,
                        float c,
                        float w)

setRotation

public void setRotation(Quaternion q)

step

public void step(float h)
apply the linear and angular velocities over time interval h, thereby adjusting its position and orientation.


addGeom

public void addGeom(Geom g)

getGeom

public Geom getGeom()
Convention method, makes Joode like Odejava

Returns:
first geom associated with body

setEnabled

public void setEnabled(boolean e)

setGravityMode

public void setGravityMode(boolean m)

setFiniteRotations

public void setFiniteRotations(boolean b)
sets the body flag to use finite rotations This is the more accurate method for stepping the body, where rotations are not assumed to be infintesimaly small

Parameters:
b -

isFiniteRotations

public boolean isFiniteRotations()

isEnabled

public boolean isEnabled()

isAutoDisabled

public boolean isAutoDisabled()

enable

public void enable()

disable

public void disable()

setAutoDisable

public void setAutoDisable(boolean e)

setStepDisableThreshold

public void setStepDisableThreshold(int i)

setLinearVel

public void setLinearVel(float fx,
                         float fy,
                         float fz)

getLinearVel

public void getLinearVel(Vector3f v)

setAngularVel

public void setAngularVel(float fx,
                          float fy,
                          float fz)

getAngularVel

public void getAngularVel(Vector3f v)

getForce

public void getForce(Vector3f v)

getTorque

public void getTorque(Vector3f v)

resetForces

public void resetForces()

addForce

public void addForce(float fx,
                     float fy,
                     float fz)

addTorque

public void addTorque(float fx,
                      float fy,
                      float fz)

addRelForce

public void addRelForce(float fx,
                        float fy,
                        float fz)

addRelTorque

public void addRelTorque(float fx,
                         float fy,
                         float fz)

addForceAtPos

public void addForceAtPos(float fx,
                          float fy,
                          float fz,
                          float px,
                          float py,
                          float pz)

addForceAtRelPos

public void addForceAtRelPos(float fx,
                             float fy,
                             float fz,
                             float px,
                             float py,
                             float pz)

addRelForceAtPos

public void addRelForceAtPos(float fx,
                             float fy,
                             float fz,
                             float px,
                             float py,
                             float pz)

addRelForceAtRelPos

public void addRelForceAtRelPos(float fx,
                                float fy,
                                float fz,
                                float px,
                                float py,
                                float pz)

cloneState

public Body 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.

Parameters:
util - instanciate a new one if top level cloning

getAngularVelocityToTurn

public void getAngularVelocityToTurn(Quaternion dq,
                                     float fps,
                                     Vector3 angularPassback)

calculates what the angular velocity should be set to, for the body to change orientation by the amount specified by the quaternion argument over the time 1/fps

This method does not work accuratly when the finiteRotation flag is off

Parameters:
dq - the rotation required i.e. the bodies final orientation should be R*q
angularPassback -