org.odejava
Class PlaceableGeom

java.lang.Object
  extended by org.odejava.Geom
      extended by org.odejava.PlaceableGeom
All Implemented Interfaces:
Placeable
Direct Known Subclasses:
GeomBox, GeomCapsule, GeomCone, GeomCylinder, GeomSphere, GeomTransform, GeomTriMesh

public abstract class PlaceableGeom
extends Geom
implements Placeable

A Geom that is placeable as defined by ODE. These geom's can be moved and rotated.

Author:
William Denniss

Field Summary
 
Fields inherited from class org.odejava.Geom
geomId, isEncapsulated, spaceId
 
Constructor Summary
protected PlaceableGeom()
          Calls the super constructor
protected PlaceableGeom(String name)
          Calls the super constructor
 
Method Summary
 void delete()
          Destroys the Geom, removing it from ODE.
 boolean fixed()
          Returns true if this Placeable is dynamic and false if it is static.
 org.openmali.vecmath2.AxisAngle3f getAxisAngle()
          Returns the axis and angle of rotation which makes up the rotational component of the transform
 org.openmali.vecmath2.AxisAngle3f getAxisAngle(org.openmali.vecmath2.AxisAngle3f result)
          Returns the axis and angle of rotation which makes up the rotational component of the transform using the provided AxisAngle3f.
 Body getBody()
          Returns the Body this Geom is attached to.
 org.openmali.vecmath2.Tuple3f getPosition()
          Returns the current position.
 void getPosition(float[] result)
          Returns the current position using the provided float array.
 org.openmali.vecmath2.Tuple3f getPosition(org.openmali.vecmath2.Tuple3f result)
          Returns the current position using the provided Vector3f
 org.openmali.vecmath2.Quaternion4f getQuaternion()
          Returns the quaternion.
 org.openmali.vecmath2.Quaternion4f getQuaternion(org.openmali.vecmath2.Quaternion4f result)
          Returns the quaternion using the provided Quad4f
 org.openmali.vecmath2.Matrix3f getRotation()
          Gets the rotation matrix of the geom
 void setAxisAndAngle(org.openmali.vecmath2.AxisAngle3f axisAngle)
          Sets the rotation using the given axis and angle.
 void setAxisAndAngle(float ax, float ay, float az, float angle)
          Sets the rotation using the given axis and angle.
protected  void setBody(Body body)
          Sets this Geom's body and calls the ODE method void dGeomSetBody (dGeomID, dBodyID).
 void setPosition(float x, float y, float z)
          Sets the position of this transformable
 void setPosition(org.openmali.vecmath2.Tuple3f position)
          Sets the position of this transformable
 void setQuaternion(org.openmali.vecmath2.Quaternion4f quaternion)
          Sets the rotation of the geom using a quaternion
 void setQuatWXYZ(float w, float x, float y, float z)
          Sets the rotation of the geom using a quaternion
 void setRotation(org.openmali.vecmath2.Matrix3f r)
          Sets the rotation of this geom using a 3x3 rotation matrix
 
Methods inherited from class org.odejava.Geom
addToSpace, finalize, getGeomFromNativeAddr, getId, getID, getName, getNativeAddr, getUserData, isEnabled, removeFromSpace, setCategoryBits, setCollideBits, setEnabled, setName, setUserData, updateNativeAddr
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.odejava.Placeable
getName
 

Constructor Detail

PlaceableGeom

protected PlaceableGeom()
Calls the super constructor


PlaceableGeom

protected PlaceableGeom(String name)
Calls the super constructor

Parameters:
name - the name of this geom
Method Detail

setPosition

public void setPosition(org.openmali.vecmath2.Tuple3f position)
Sets the position of this transformable

Specified by:
setPosition in interface Placeable
Parameters:
position - to set
ODE Calls:
dGeomSetPosition

setQuatWXYZ

public void setQuatWXYZ(float w,
                        float x,
                        float y,
                        float z)
Sets the rotation of the geom using a quaternion

Parameters:
w - w coordinate
x - x coordinate
y - y coordinate
z - z coordinate
ODE Calls:
dGeomSetQuaternion

setQuaternion

public void setQuaternion(org.openmali.vecmath2.Quaternion4f quaternion)
Sets the rotation of the geom using a quaternion

Specified by:
setQuaternion in interface Placeable
Parameters:
quaternion - the rotation quaternion to use
ODE Calls:
dGeomSetQuaternion

setRotation

public void setRotation(org.openmali.vecmath2.Matrix3f r)
Sets the rotation of this geom using a 3x3 rotation matrix

Specified by:
setRotation in interface Placeable
Parameters:
r - rotation matrix to use
ODE Calls:
dGeomSetRotation

setAxisAndAngle

public final void setAxisAndAngle(org.openmali.vecmath2.AxisAngle3f axisAngle)
Sets the rotation using the given axis and angle.

Specified by:
setAxisAndAngle in interface Placeable
Parameters:
axisAngle - the axis and angle.

setAxisAndAngle

public void setAxisAndAngle(float ax,
                            float ay,
                            float az,
                            float angle)
Sets the rotation using the given axis and angle.

Parameters:
ax - Axis X component
ay - Axis Y component
az - Axis Z component
angle - angle component
ODE Calls:
dGeomSetQuaternion

getAxisAngle

public org.openmali.vecmath2.AxisAngle3f getAxisAngle()
Returns the axis and angle of rotation which makes up the rotational component of the transform

Specified by:
getAxisAngle in interface Placeable
Returns:
the axis and angle of rotation

getAxisAngle

public org.openmali.vecmath2.AxisAngle3f getAxisAngle(org.openmali.vecmath2.AxisAngle3f result)
Returns the axis and angle of rotation which makes up the rotational component of the transform using the provided AxisAngle3f.

Specified by:
getAxisAngle in interface Placeable
Parameters:
result - the result AxisAngle3f
Returns:
the axis and angle of rotation

getPosition

public org.openmali.vecmath2.Tuple3f getPosition()
Returns the current position.

Specified by:
getPosition in interface Placeable
Returns:
the current position.
ODE Calls:
dGeomGetPosition

getPosition

public org.openmali.vecmath2.Tuple3f getPosition(org.openmali.vecmath2.Tuple3f result)
Returns the current position using the provided Vector3f

Specified by:
getPosition in interface Placeable
Parameters:
result - The result Vector3f
Returns:
the current position
ODE Calls:
dGeomGetPosition

getPosition

public void getPosition(float[] result)
Returns the current position using the provided float array.

Parameters:
result - The result array at least length 3
ODE Calls:
dGeomGetPosition

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Sets the position of this transformable

Specified by:
setPosition in interface Placeable
Parameters:
x - X coordinate
y - Y coordinate
z - Z coordinate
ODE Calls:
dGeomSetPosition

getQuaternion

public org.openmali.vecmath2.Quaternion4f getQuaternion()
Returns the quaternion.

Specified by:
getQuaternion in interface Placeable
Returns:
the quaternion.
ODE Calls:
dGeomGetQuaternion

getQuaternion

public org.openmali.vecmath2.Quaternion4f getQuaternion(org.openmali.vecmath2.Quaternion4f result)
Returns the quaternion using the provided Quad4f

Specified by:
getQuaternion in interface Placeable
Parameters:
result - the result Quad4f.
Returns:
the quaternion.
ODE Calls:
dGeomGetQuaternion

getRotation

public org.openmali.vecmath2.Matrix3f getRotation()
Gets the rotation matrix of the geom

Specified by:
getRotation in interface Placeable
Returns:
the rotation matrix
ODE Calls:
dGeomGetRotation

getBody

public Body getBody()
Returns the Body this Geom is attached to.

Returns:
the Body this Geom is attached to.

setBody

protected void setBody(Body body)

Sets this Geom's body and calls the ODE method void dGeomSetBody (dGeomID, dBodyID). The position and rotation components of the this Geom and the passed Body are combined so that setting one will also set the other.

If null is passed, the Geom will be set to have no Body. If it was previously attached to a Body then it's translation and rotation will be that of the Body when this method was called. From then on it has its own translation and rotation.

This method is automatically called by Body.addGeom and Body.removeGeom. It should not be used outside those two methods, and such use may result in errors or ambiguous cases (such as two Bodies thinking they both have this Geom as their child when in actual fact, a Body can only have one parent). In some (but not all) cases - such attempts will cause an AssertionException to be thrown.

Parameters:
body - The body to set.
ODE Calls:
dGeomSetBody - sets the body of this geom

fixed

public boolean fixed()
Description copied from interface: Placeable
Returns true if this Placeable is dynamic and false if it is static. Dynamic Placeable's have changing transform's whereas static ones are fixed.

Specified by:
fixed in interface Placeable
Returns:
rue if this Placeable is dynamic and false if it is static

delete

public void delete()
Description copied from class: Geom
Destroys the Geom, removing it from ODE. Dereferences user data.

Overrides:
delete in class Geom