org.odejava
Class Geom

java.lang.Object
  extended by org.odejava.Geom
Direct Known Subclasses:
GeomPlane, GeomRay, GeomTerrain, PlaceableGeom

public abstract class Geom
extends Object

Geometry objects (or geoms for short) are the fundamental objects in the collision system. A geom can represents a single rigid shape (such as a sphere or box), or it can represents a group of other geoms - this is a special kind of geom called a space.

Any geom can be collided against any other geom to yield zero or more contact points. Spaces have the extra capability of being able to collide their contained geoms together to yield internal contact points.

The rotation matrix, just like a rigid body, that can be changed during the simulation. A non-placeable geom does not have this capability - for example, it may represent some static feature of the environment that can not be moved. Spaces are non-placeable geoms, because each contained geom may have its own position and orientation but it does not make sense for the space itself to have a position and orientation.

To use the collision engine in a rigid body simulation, placeable geoms are associated with rigid body objects. This allows the collision engine to get the position and orientation of the geoms from the bodies. Note that geoms are distinct from rigid bodies in that a geom has geometrical properties (size, shape, position and orientation) but no dynamical properties (such as velocity or mass). A body and a geom together represent all the properties of the simulated object.

Created 16.12.2003 (dd.mm.yyyy)

Author:
Jani Laakso E-mail: jani.laakso@itmill.com see http://odejava.dev.java.net

Field Summary
protected  org.odejava.ode.SWIGTYPE_p_dGeomID geomId
           
protected  boolean isEncapsulated
           
protected  org.odejava.ode.SWIGTYPE_p_dSpaceID spaceId
           
 
Constructor Summary
protected Geom()
          Create a generic geometry item with no associated name.
protected Geom(String name)
          Create a generic items of geometry with an associated name.
 
Method Summary
protected  void addToSpace(Space space)
          Removes this Geom from the ZERO space and adds it to the given one.
 void delete()
          Destroys the Geom, removing it from ODE.
protected  void finalize()
          Calls the delete() method to clean up native resources if it hasn't already been called on this Geom.
static Geom getGeomFromNativeAddr(long nativeAddress)
          Performs lookup of a WeakHashMap and returns the Geom with the native address equal to the one passed or null if none exist.
 org.odejava.ode.SWIGTYPE_p_dGeomID getId()
           
 long getID()
           
 String getName()
          Returns the name of the Geom.
 long getNativeAddr()
          Native address can be used to compare against contact information values which are also native addresses.
 Object getUserData()
           
 boolean isEnabled()
           
protected  void removeFromSpace()
          Removes this Geom from its space and adds it to the empty space.
 void setCategoryBits(long bits)
           
 void setCollideBits(long bits)
           
 void setEnabled(boolean enabled)
          Diables or Enables this geom.
 void setName(String n)
          Sets the name of the Geom
 void setUserData(Object userData)
           
protected  void updateNativeAddr()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spaceId

protected org.odejava.ode.SWIGTYPE_p_dSpaceID spaceId

geomId

protected org.odejava.ode.SWIGTYPE_p_dGeomID geomId

isEncapsulated

protected boolean isEncapsulated
Constructor Detail

Geom

protected Geom()
Create a generic geometry item with no associated name.


Geom

protected Geom(String name)
Create a generic items of geometry with an associated name. The name reference may be null.

Parameters:
name - A name to associate with this geometry
Method Detail

getId

public org.odejava.ode.SWIGTYPE_p_dGeomID getId()

getID

public final long getID()

setCategoryBits

public void setCategoryBits(long bits)

setCollideBits

public void setCollideBits(long bits)

getName

public String getName()
Returns the name of the Geom.

Returns:
Returns the name of the Geom.

setName

public void setName(String n)
Sets the name of the Geom

Parameters:
n - The name of the Geom.

delete

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

ODE Calls:
dGeomDestory

finalize

protected void finalize()
Calls the delete() method to clean up native resources if it hasn't already been called on this Geom.

Overrides:
finalize in class Object

setEnabled

public void setEnabled(boolean enabled)
Diables or Enables this geom.

Parameters:
enabled -
ODE Calls:
dGeomEnable - (if true is passed)
dGeomDiable - (if false is passed)

isEnabled

public boolean isEnabled()
Returns:
Diabled or Enabled state of this geom.
ODE Calls:
dGeomEnable - (if true is passed)
dGeomDiable - (if false is passed)

updateNativeAddr

protected void updateNativeAddr()

getGeomFromNativeAddr

public static Geom getGeomFromNativeAddr(long nativeAddress)
Performs lookup of a WeakHashMap and returns the Geom with the native address equal to the one passed or null if none exist.

Parameters:
nativeAddress - the native address to lookup
Returns:
the Geom with the native address equal to the one passed or null if none can be found.

getNativeAddr

public long getNativeAddr()

Native address can be used to compare against contact information values which are also native addresses.

UNSUPPORTED - use of this method is better avoided. No guarantees are made that this method won't change or even exist in future versions.

Returns:
Returns the native address.

removeFromSpace

protected void removeFromSpace()
Removes this Geom from its space and adds it to the empty space. This method is automatically called by Space.remove and should not be called directly

See Also:
Space.remove(org.odejava.Geom)
ODE Calls:
dSpaceRemove - removes the Geom from the current Space

addToSpace

protected void addToSpace(Space space)
Removes this Geom from the ZERO space and adds it to the given one. This methods is automatically called from Space.addGeom and should not be called directly. An assert will cause an exception to be thrown if this Geom already belongs to a space.

See Also:
Space.addGeom(org.odejava.Geom)
ODE Calls:
dSpaceAdd - adds the geom to the given space

getUserData

public final Object getUserData()
Returns:
Returns the userData.

setUserData

public final void setUserData(Object userData)
Parameters:
userData - The userData to set.