hmi.physics.ode
Class OdeRigidBody

java.lang.Object
  extended by hmi.physics.RigidBody
      extended by hmi.physics.ode.OdeRigidBody
All Implemented Interfaces:
VObject

public class OdeRigidBody
extends RigidBody


Nested Class Summary
 
Nested classes/interfaces inherited from interface hmi.animation.VObject
VObject.Predicate
 
Field Summary
private  org.odejava.Body body
           
private  org.slf4j.Logger logger
           
private  OdeMass mass
           
private  int shapeNr
           
private  org.odejava.Space space
           
private  float[] tempq
           
private  float[] tempv
           
private  org.odejava.World world
           
 
Fields inherited from class hmi.physics.RigidBody
collisionShapes, id, name, rotationBuffer, sid, translationBuffer
 
Constructor Summary
OdeRigidBody(String n, org.odejava.World w, org.odejava.Space s)
          Constructor
 
Method Summary
 OdeCollisionBox addBox(float[] halfExtends)
          Add a collision box to the local origin
 OdeCollisionBox addBox(float[] q, float[] tr, float[] halfExtends)
          Adds a collision box
 OdeCollisionCapsule addCapsule(float[] q, float[] tr, float radius, float height)
          Adds a collision capsule, aligned with y-axis
 OdeCollisionCapsule addCapsule(float radius, float height)
          Adds a collision capsule, aligned with y-axis
private  void addCollisionGeom(org.odejava.PlaceableGeom g)
           
 void addForce(float x, float y, float z)
           
 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 addRelForce(float x, float y, float z)
           
 void addRelForceAtRelPos(float fx, float fy, float fz, float px, float py, float pz)
           
 void addRelTorque(float x, float y, float z)
           
 OdeCollisionSphere addSphere(float radius)
          Adds a collision sphere at the local origin
 OdeCollisionSphere addSphere(float[] tr, float radius)
          Adds a collision capsule, aligned with y-axis
 void addTorque(float x, float y, float z)
           
 void adjustMass(float m)
          Sets the new mass
protected  void checkForce(float x, float y, float z)
           
 void clear()
          prepares the body for removal
 Mass createMass()
           
 void getAngularVelocity(float[] result)
          Returns the angular velocity vector in the form of a float array of length three.
 void getAngularVelocity(float[] vc, int vcIndex)
          Like getAngularVelocity(wa), but starting at the specified offset.
 org.odejava.Body getBody()
           
 void getCOM(float[] com)
           
 void getForce(float[] force)
           
 void getInertiaTensor(float[] I)
           
 float getMass()
           
 void getPointRelPosition(float[] dst, float[] point)
          Gets the world position of a point on the body, returns the result in dst
 void getPointVelocity(float[] dst, float[] point)
          Get the velocity of a point on the rigid body, returns the result in dst
 void getRelativePointVelocity(float[] dst, float[] point)
          Get the velocity of a point on the rigid body, in coordinates relative to the body.
 void getRotation(float[] result)
          Returns the rotation quaternion in a float array of length four.
 void getRotation(float[] result, int idx)
          Like getRotation(ra), but starting at the specified offset.
 void getTorque(float[] torque)
           
 void getTranslation(float[] pos)
          Returns the translation vector in the form of a float array of length three
 void getTranslation(float[] pos, int idx)
          Like getTranslation(ta), but starting at the specified offset
 void getVelocity(float[] result)
          Returns the velocity vector in the form of a float array of length three.
 void getVelocity(float[] result, int idx)
          Like getVelocity(va), but starting at the specified offset.
private  void removeCollisionGeom(org.odejava.PlaceableGeom g)
           
 void removeCollisionShape(CollisionShape s)
          Removes a collision shape
 void rotateInertiaTensor(float[] q)
           
 void setAngularVelocity(float x, float y, float z)
          Sets the angular velocity vector from three floats.
 void setCOM(float[] com)
           
 void setEnabled(boolean enabled)
          Disables or enables the body.
 void setForce(float x, float y, float z)
           
 void setId(String n)
          Sets the id for this VObject.
 void setInertiaTensor(float[] I)
           
 void setMass(OdeMass m)
           
 void setRotation(float w, float x, float y, float z)
          Sets the rotation quaternion from four floats.
 void setTorque(float x, float y, float z)
           
 void setTranslation(float x, float y, float z)
          Sets the current translation vector from three floats.
 void setVelocity(float x, float y, float z)
          Sets the velocity vector from three floats.
 void translateInertiaTensor(float[] v)
           
 
Methods inherited from class hmi.physics.RigidBody
addForce, addForceAtPos, addForceAtRelPos, addRelForce, addRelForceAtRelPos, addRelTorque, addRotationBuffer, addTorque, addTranslationBuffer, copy, getCollisionShapes, getId, getName, getRotationBuffer, getScale, getScale, getScaleBuffer, getSid, getTranslationBuffer, setAngularVelocity, setAngularVelocity, setAxisAngle, setMass, setName, setRotation, setRotation, setScale, setScale, setSid, setTranslation, setTranslation, setVelocity, setVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

body

private org.odejava.Body body

world

private org.odejava.World world

space

private org.odejava.Space space

mass

private OdeMass mass

shapeNr

private int shapeNr

tempv

private float[] tempv

tempq

private float[] tempq

logger

private org.slf4j.Logger logger
Constructor Detail

OdeRigidBody

public OdeRigidBody(String n,
                    org.odejava.World w,
                    org.odejava.Space s)
Constructor

Parameters:
n - new name, id, sid
w - ODE world
s - ODE space
Method Detail

getMass

public float getMass()
Specified by:
getMass in class RigidBody

setMass

public void setMass(OdeMass m)

setId

public void setId(String n)
Description copied from interface: VObject
Sets the id for this VObject.

Specified by:
setId in interface VObject
Overrides:
setId in class RigidBody

setTranslation

public void setTranslation(float x,
                           float y,
                           float z)
Description copied from interface: VObject
Sets the current translation vector from three floats.

Specified by:
setTranslation in interface VObject
Specified by:
setTranslation in class RigidBody

setRotation

public void setRotation(float w,
                        float x,
                        float y,
                        float z)
Description copied from interface: VObject
Sets the rotation quaternion from four floats. qs is the real part, qx, qy, qz the imaginary parts.

Specified by:
setRotation in interface VObject
Specified by:
setRotation in class RigidBody

setAngularVelocity

public void setAngularVelocity(float x,
                               float y,
                               float z)
Description copied from interface: VObject
Sets the angular velocity vector from three floats.

Specified by:
setAngularVelocity in interface VObject
Specified by:
setAngularVelocity in class RigidBody

setForce

public void setForce(float x,
                     float y,
                     float z)
Specified by:
setForce in class RigidBody

checkForce

protected void checkForce(float x,
                          float y,
                          float z)

addForce

public void addForce(float x,
                     float y,
                     float z)
Specified by:
addForce in class RigidBody

addForceAtRelPos

public void addForceAtRelPos(float fx,
                             float fy,
                             float fz,
                             float px,
                             float py,
                             float pz)
Specified by:
addForceAtRelPos in class RigidBody

addForceAtPos

public void addForceAtPos(float fx,
                          float fy,
                          float fz,
                          float px,
                          float py,
                          float pz)
Specified by:
addForceAtPos in class RigidBody

setVelocity

public void setVelocity(float x,
                        float y,
                        float z)
Description copied from interface: VObject
Sets the velocity vector from three floats.

Specified by:
setVelocity in interface VObject
Specified by:
setVelocity in class RigidBody

setTorque

public void setTorque(float x,
                      float y,
                      float z)
Specified by:
setTorque in class RigidBody

addTorque

public void addTorque(float x,
                      float y,
                      float z)
Specified by:
addTorque in class RigidBody

getBody

public org.odejava.Body getBody()
Returns:
the body

getTranslation

public void getTranslation(float[] pos)
Description copied from interface: VObject
Returns the translation vector in the form of a float array of length three

Specified by:
getTranslation in interface VObject
Specified by:
getTranslation in class RigidBody

getTranslation

public void getTranslation(float[] pos,
                           int idx)
Description copied from interface: VObject
Like getTranslation(ta), but starting at the specified offset


addCollisionGeom

private void addCollisionGeom(org.odejava.PlaceableGeom g)

removeCollisionGeom

private void removeCollisionGeom(org.odejava.PlaceableGeom g)

getRotation

public void getRotation(float[] result)
Description copied from interface: VObject
Returns the rotation quaternion in a float array of length four. The order is (s, x, y, z), where s is the scalar part, x, y, z are the imaginary parts.

Specified by:
getRotation in interface VObject
Specified by:
getRotation in class RigidBody

getRotation

public void getRotation(float[] result,
                        int idx)
Description copied from interface: VObject
Like getRotation(ra), but starting at the specified offset.

Specified by:
getRotation in interface VObject
Specified by:
getRotation in class RigidBody

getAngularVelocity

public void getAngularVelocity(float[] result)
Description copied from interface: VObject
Returns the angular velocity vector in the form of a float array of length three.

Specified by:
getAngularVelocity in interface VObject
Specified by:
getAngularVelocity in class RigidBody

getAngularVelocity

public void getAngularVelocity(float[] vc,
                               int vcIndex)
Description copied from interface: VObject
Like getAngularVelocity(wa), but starting at the specified offset.

Specified by:
getAngularVelocity in interface VObject
Specified by:
getAngularVelocity in class RigidBody

getVelocity

public void getVelocity(float[] result)
Description copied from interface: VObject
Returns the velocity vector in the form of a float array of length three.

Specified by:
getVelocity in interface VObject
Specified by:
getVelocity in class RigidBody

getVelocity

public void getVelocity(float[] result,
                        int idx)
Description copied from interface: VObject
Like getVelocity(va), but starting at the specified offset.


adjustMass

public void adjustMass(float m)
Description copied from class: RigidBody
Sets the new mass

Specified by:
adjustMass in class RigidBody

addBox

public OdeCollisionBox addBox(float[] halfExtends)
Description copied from class: RigidBody
Add a collision box to the local origin

Specified by:
addBox in class RigidBody
Parameters:
halfExtends - half-sizes along x,y,z
Returns:
the box

addBox

public OdeCollisionBox addBox(float[] q,
                              float[] tr,
                              float[] halfExtends)
Description copied from class: RigidBody
Adds a collision box

Specified by:
addBox in class RigidBody
Parameters:
q - local rotation
tr - local translation
halfExtends - half-sizes along x,y,z

addCapsule

public OdeCollisionCapsule addCapsule(float[] q,
                                      float[] tr,
                                      float radius,
                                      float height)
Description copied from class: RigidBody
Adds a collision capsule, aligned with y-axis

Specified by:
addCapsule in class RigidBody
Parameters:
q - local rotation
tr - local translation
radius - radius of the balls and cylinder
height - (on y-axis)

addCapsule

public OdeCollisionCapsule addCapsule(float radius,
                                      float height)
Description copied from class: RigidBody
Adds a collision capsule, aligned with y-axis

Specified by:
addCapsule in class RigidBody
Parameters:
radius - radius of the balls and cylinder
height - (on y-axis) of the cylinder

addSphere

public OdeCollisionSphere addSphere(float[] tr,
                                    float radius)
Description copied from class: RigidBody
Adds a collision capsule, aligned with y-axis

Specified by:
addSphere in class RigidBody
Parameters:
tr - local translation
radius - radius of the balls and cylinder

addSphere

public OdeCollisionSphere addSphere(float radius)
Description copied from class: RigidBody
Adds a collision sphere at the local origin

Specified by:
addSphere in class RigidBody
Parameters:
radius - radius of the sphere

getCOM

public void getCOM(float[] com)
Specified by:
getCOM in class RigidBody

getInertiaTensor

public void getInertiaTensor(float[] I)
Specified by:
getInertiaTensor in class RigidBody

setCOM

public void setCOM(float[] com)
Specified by:
setCOM in class RigidBody

setInertiaTensor

public void setInertiaTensor(float[] I)
Specified by:
setInertiaTensor in class RigidBody

removeCollisionShape

public void removeCollisionShape(CollisionShape s)
Description copied from class: RigidBody
Removes a collision shape

Specified by:
removeCollisionShape in class RigidBody

clear

public void clear()
Description copied from class: RigidBody
prepares the body for removal

Overrides:
clear in class RigidBody

getPointRelPosition

public void getPointRelPosition(float[] dst,
                                float[] point)
Description copied from class: RigidBody
Gets the world position of a point on the body, returns the result in dst

Specified by:
getPointRelPosition in class RigidBody

getPointVelocity

public void getPointVelocity(float[] dst,
                             float[] point)
Description copied from class: RigidBody
Get the velocity of a point on the rigid body, returns the result in dst

Specified by:
getPointVelocity in class RigidBody

getRelativePointVelocity

public void getRelativePointVelocity(float[] dst,
                                     float[] point)
Description copied from class: RigidBody
Get the velocity of a point on the rigid body, in coordinates relative to the body. returns the result in dst

Specified by:
getRelativePointVelocity in class RigidBody

addRelTorque

public void addRelTorque(float x,
                         float y,
                         float z)
Specified by:
addRelTorque in class RigidBody

getTorque

public void getTorque(float[] torque)
Specified by:
getTorque in class RigidBody

getForce

public void getForce(float[] force)
Specified by:
getForce in class RigidBody

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: RigidBody
Disables or enables the body. Disabled bodies are not updated with the physical simulation step and do not collide with other bodies.

Specified by:
setEnabled in class RigidBody

addRelForce

public void addRelForce(float x,
                        float y,
                        float z)
Specified by:
addRelForce in class RigidBody

addRelForceAtRelPos

public void addRelForceAtRelPos(float fx,
                                float fy,
                                float fz,
                                float px,
                                float py,
                                float pz)
Specified by:
addRelForceAtRelPos in class RigidBody

rotateInertiaTensor

public void rotateInertiaTensor(float[] q)
Specified by:
rotateInertiaTensor in class RigidBody

translateInertiaTensor

public void translateInertiaTensor(float[] v)
Specified by:
translateInertiaTensor in class RigidBody

createMass

public Mass createMass()
Specified by:
createMass in class RigidBody