org.ode4j.ode
Interface DGeom

All Known Subinterfaces:
DBox, DCapsule, DConvex, DCylinder, DGeomTransform, DHashSpace, DHeightfield, DPlane, DQuadTreeSpace, DRay, DSapSpace, DSimpleSpace, DSpace, DSphere, DTriMesh

public interface DGeom

Common base class for all geometries.


Nested Class Summary
static class DGeom.COLLIDER_MERGE_CONTACTS_VALUE
           
static class DGeom.CONTROL_CLASS
           
static class DGeom.CONTROL_CODE
           
static interface DGeom.DataValue
          Deprecated. not implemented yet.
static interface DGeom.DNearCallback
          User callback for geom-geom collision testing.
 
Field Summary
static int dBoxClass
           
static int dCapsuleClass
           
static int dConvexClass
           
static int dCylinderClass
           
static int dFirstSpaceClass
           
static int dFirstUserClass
          ID of the first user defined class.
static int dGeomNumClasses
           
static int dGeomTransformClass
           
static int dHashSpaceClass
           
static int dHeightfieldClass
           
static int dLastSpaceClass
           
static int dLastUserClass
           
static int dMaxUserClasses
          the maximum number of user classes that are supported.
static int dPlaneClass
           
static int dQuadTreeSpaceClass
           
static int dRayClass
           
static int dSimpleSpaceClass
           
static int dSphereClass
          class numbers - each geometry object needs a unique number.
static int dSweepAndPruneSpaceClass
           
static int dTriMeshClass
           
 
Method Summary
 void clearOffset()
          Clear any offset from the geom.
 void collide2(DGeom g, java.lang.Object data, DGeom.DNearCallback callback)
           
 void copyOffsetPosition(DVector3 pos)
          Copy the offset position vector of a geom.
 void copyOffsetRotation(DMatrix3 R)
          Copy the offset rotation matrix of a geom.
 void copyPosition(DVector3 pos)
          Copy the position of a geom into a vector.
 void copyRotation(DMatrix3 R)
          Get the rotation matrix of a placeable geom.
 void destroy()
          Destroy a geom, removing it from any space.
 void DESTRUCTOR()
           
 void disable()
          Disable a geom.
 void enable()
          Enable a geom.
 DAABBC getAABB()
          Return the axis-aligned bounding box.
 DBody getBody()
          Get the body associated with a placeable geom.
 long getCategoryBits()
          Get the "category" bitfield for the given geom.
 int getClassID()
          Given a geom, this returns its class.
 long getCollideBits()
          Get the "collide" bitfield for the given geom.
 java.lang.Object getData()
          Get the user-defined data pointer stored in the geom.
 DVector3C getOffsetPosition()
          Get the offset position vector of a geom.
 void getOffsetQuaternion(DQuaternion result)
          Get the offset rotation quaternion of a geom.
 DMatrix3C getOffsetRotation()
          Get the offset rotation matrix of a geom.
 DVector3C getPosition()
          Get the position vector of a placeable geom.
 void getPosRelPoint(double px, double py, double pz, DVector3 result)
          Takes a point in global coordinates and returns the point's position in geom-relative coordinates.
 DQuaternionC getQuaternion()
          Get the rotation quaternion of a placeable geom.
 void getRelPointPos(double px, double py, double pz, DVector3 result)
          Get world position of a relative point on geom.
 DMatrix3C getRotation()
          Get the rotation matrix of a placeable geom.
 DSpace getSpace()
          Query for the space containing a particular geom.
 boolean isEnabled()
          Check to see if a geom is enabled.
 boolean isOffset()
          Check to see whether the geom has an offset.
 boolean lowLevelControl(DGeom.CONTROL_CLASS controlClass, DGeom.CONTROL_CODE controlCode, DGeom.DataValue dataValue, org.cpp4j.java.RefInt dataSize)
          Execute low level control operation for geometry.
 void setBody(DBody body)
          Set the body associated with a placeable geom.
 void setCategoryBits(long bits)
          Set the "category" bitfield for the given geom.
 void setCollideBits(long bits)
          Set the "collide" bitfield for the given geom.
 void setData(java.lang.Object data)
          Set the user-defined data pointer stored in the geom.
 void setOffsetPosition(double x, double y, double z)
          Set the local offset position of a geom from its body.
 void setOffsetQuaternion(DQuaternionC q)
          Set the local offset rotation of a geom from its body.
 void setOffsetRotation(DMatrix3C R)
          Set the local offset rotation matrix of a geom from its body.
 void setOffsetWorldPosition(double x, double y, double z)
          Set the offset position of a geom from its body.
 void setOffsetWorldQuaternion(DQuaternionC q)
          Set the offset rotation of a geom from its body.
 void setOffsetWorldRotation(DMatrix3C R)
          Set the offset rotation of a geom from its body.
 void setPosition(double x, double y, double z)
          Set the position vector of a placeable geom.
 void setPosition(DVector3C xyz)
          Set the position vector of a placeable geom.
 void setQuaternion(DQuaternionC quat)
          Set the rotation of a placeable geom.
 void setRotation(DMatrix3C R)
          Set the rotation matrix of a placeable geom.
 void vectorFromWorld(double px, double py, double pz, DVector3 result)
          Convert from world to geom-local coordinates.
 void vectorToWorld(double px, double py, double pz, DVector3 result)
          Convert from geom-local to world coordinates.
 

Field Detail

dMaxUserClasses

static final int dMaxUserClasses
the maximum number of user classes that are supported.

See Also:
Constant Field Values

dSphereClass

static final int dSphereClass
class numbers - each geometry object needs a unique number. (TZ) This has not been made an 'enum' to leave it easily extensible for user defined classes.

See Also:
Constant Field Values

dBoxClass

static final int dBoxClass
See Also:
Constant Field Values

dCapsuleClass

static final int dCapsuleClass
See Also:
Constant Field Values

dCylinderClass

static final int dCylinderClass
See Also:
Constant Field Values

dPlaneClass

static final int dPlaneClass
See Also:
Constant Field Values

dRayClass

static final int dRayClass
See Also:
Constant Field Values

dConvexClass

static final int dConvexClass
See Also:
Constant Field Values

dGeomTransformClass

static final int dGeomTransformClass
See Also:
Constant Field Values

dTriMeshClass

static final int dTriMeshClass
See Also:
Constant Field Values

dHeightfieldClass

static final int dHeightfieldClass
See Also:
Constant Field Values

dFirstSpaceClass

static final int dFirstSpaceClass
See Also:
Constant Field Values

dSimpleSpaceClass

static final int dSimpleSpaceClass
See Also:
Constant Field Values

dHashSpaceClass

static final int dHashSpaceClass
See Also:
Constant Field Values

dSweepAndPruneSpaceClass

static final int dSweepAndPruneSpaceClass
See Also:
Constant Field Values

dQuadTreeSpaceClass

static final int dQuadTreeSpaceClass
See Also:
Constant Field Values

dLastSpaceClass

static final int dLastSpaceClass
See Also:
Constant Field Values

dFirstUserClass

static final int dFirstUserClass
ID of the first user defined class. These IDs may change between software releases!
To avoid problem, user defined classes should have their IDs allocated based on dFirstUserClass, for example: int myCLassID = dFirstUserClass + x;, where (x >= 1).

See Also:
Constant Field Values

dLastUserClass

static final int dLastUserClass
See Also:
Constant Field Values

dGeomNumClasses

static final int dGeomNumClasses
See Also:
Constant Field Values
Method Detail

DESTRUCTOR

void DESTRUCTOR()

destroy

void destroy()
Destroy a geom, removing it from any space.

Destroy a geom, removing it from any space it is in first. This one function destroys a geom of any type, but to create a geom you must call a creation function for that type.

When a space is destroyed, if its cleanup mode is 1 (the default) then all the geoms in that space are automatically destroyed as well.


getClassID

int getClassID()
Given a geom, this returns its class.

The ODE classes are:

  • dSphereClass
  • dBoxClass
  • dCylinderClass
  • dPlaneClass
  • dRayClass
  • dConvexClass
  • dGeomTransformClass
  • dTriMeshClass
  • dSimpleSpaceClass
  • dHashSpaceClass
  • dQuadTreeSpaceClass
  • dFirstUserClass
  • dLastUserClass
  • User-defined class will return their own number.

    Returns:
    The geom class ID.

    getSpace

    DSpace getSpace()
    Query for the space containing a particular geom.

    Returns:
    The space that contains the geom, or NULL if the geom is not contained by a space.

    setData

    void setData(java.lang.Object data)
    Set the user-defined data pointer stored in the geom.

    Parameters:
    data - the data pointer to be stored

    getData

    java.lang.Object getData()
    Get the user-defined data pointer stored in the geom.


    setBody

    void setBody(DBody body)
    Set the body associated with a placeable geom.

    Setting a body on a geom automatically combines the position vector and rotation matrix of the body and geom, so that setting the position or orientation of one will set the value for both objects. Setting a body ID of zero gives the geom its own position and rotation, independent from any body. If the geom was previously connected to a body then its new independent position/rotation is set to the current position/rotation of the body.

    Calling these functions on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    body - the body to attach to the geom

    getBody

    DBody getBody()
    Get the body associated with a placeable geom.

    See Also:
    setBody(DBody)

    setPosition

    void setPosition(double x,
                     double y,
                     double z)
    Set the position vector of a placeable geom.

    If the geom is attached to a body, the body's position will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    x - the new X coordinate.
    y - the new Y coordinate.
    z - the new Z coordinate.
    See Also:
    DBody.setPosition(double, double, double)

    setPosition

    void setPosition(DVector3C xyz)
    Set the position vector of a placeable geom.

    If the geom is attached to a body, the body's position will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    xyz - the new X, Y and Z coordinate.
    See Also:
    DBody.setPosition(DVector3C)

    getPosition

    DVector3C getPosition()
    Get the position vector of a placeable geom.

    If the geom is attached to a body, the body's position will be returned.

    Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Returns:
    A pointer to the geom's position vector.
    See Also:
    DBody.getPosition()
    Remark:
    The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

    copyPosition

    void copyPosition(DVector3 pos)
    Copy the position of a geom into a vector.

    Parameters:
    pos - a copy of the geom position
    See Also:
    getPosition()

    setRotation

    void setRotation(DMatrix3C R)
    Set the rotation matrix of a placeable geom.

    If the geom is attached to a body, the body's rotation will also be changed. Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    R - the new rotation matrix.
    See Also:
    DBody.setRotation(DMatrix3C)

    getRotation

    DMatrix3C getRotation()
    Get the rotation matrix of a placeable geom.

    If the geom is attached to a body, the body's rotation will be returned.

    Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Returns:
    A pointer to the geom's rotation matrix.
    See Also:
    DBody.getRotation()
    Remark:
    The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

    copyRotation

    void copyRotation(DMatrix3 R)
    Get the rotation matrix of a placeable geom.

    If the geom is attached to a body, the body's rotation will be returned.

    Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    R - a copy of the geom rotation
    See Also:
    getRotation()

    setQuaternion

    void setQuaternion(DQuaternionC quat)
    Set the rotation of a placeable geom.

    If the geom is attached to a body, the body's rotation will also be changed.

    Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    Parameters:
    quat - the new rotation.
    See Also:
    DBody.setQuaternion(DQuaternionC)

    getQuaternion

    DQuaternionC getQuaternion()
    Get the rotation quaternion of a placeable geom.

    If the geom is attached to a body, the body's quaternion will be returned.

    Calling this function on a non-placeable geom results in a runtime error in the debug build of ODE.

    See Also:
    DBody.getQuaternion()

    getAABB

    DAABBC getAABB()
    Return the axis-aligned bounding box.

    Return in aabb an axis aligned bounding box that surrounds the given geom. The aabb array has elements (minx, maxx, miny, maxy, minz, maxz). If the geom is a space, a bounding box that surrounds all contained geoms is returned.

    This function may return a pre-computed cached bounding box, if it can determine that the geom has not moved since the last time the bounding box was computed.


    setCategoryBits

    void setCategoryBits(long bits)
    Set the "category" bitfield for the given geom.

    The category bitfield is used by spaces to govern which geoms will interact with each other. The bitfield is guaranteed to be at least 32 bits wide. The default category values for newly created geoms have all bits set.

    Parameters:
    bits - the new bitfield value

    setCollideBits

    void setCollideBits(long bits)
    Set the "collide" bitfield for the given geom.

    The collide bitfield is used by spaces to govern which geoms will interact with each other. The bitfield is guaranteed to be at least 32 bits wide. The default category values for newly created geoms have all bits set.

    Parameters:
    bits - the new bitfield value

    getCategoryBits

    long getCategoryBits()
    Get the "category" bitfield for the given geom.

    Returns:
    The bitfield value
    See Also:
    setCategoryBits(long)

    getCollideBits

    long getCollideBits()
    Get the "collide" bitfield for the given geom.

    Returns:
    The bitfield value
    See Also:
    setCollideBits(long)

    enable

    void enable()
    Enable a geom.

    Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state.

    See Also:
    disable(), isEnabled()

    disable

    void disable()
    Disable a geom.

    Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state.

    See Also:
    enable(), isEnabled()

    isEnabled

    boolean isEnabled()
    Check to see if a geom is enabled.

    Disabled geoms are completely ignored by dSpaceCollide and dSpaceCollide2, although they can still be members of a space. New geoms are created in the enabled state.

    Returns:
    Non-zero if the geom is enabled, zero otherwise.
    See Also:
    disable(), enable()

    collide2

    void collide2(DGeom g,
                  java.lang.Object data,
                  DGeom.DNearCallback callback)

    lowLevelControl

    boolean lowLevelControl(DGeom.CONTROL_CLASS controlClass,
                            DGeom.CONTROL_CODE controlCode,
                            DGeom.DataValue dataValue,
                            org.cpp4j.java.RefInt dataSize)
    Execute low level control operation for geometry. The variable the dataSize points to must be initialized before the call. If the size does not match the one expected for the control class/code function changes it to the size expected and returns failure. This implies the function can be called with NULL data and zero size to test if control class/code is supported and obtain required data size for it.

    dGeomCommonAnyControlCode applies to any control class and returns success if at least one control code is available for the given class with given geom.
    Currently there are the folliwing control classes supported:

  • dGeomColliderControlClass
  • For dGeomColliderControlClass there are the following codes available:

  • dGeomColliderSetMergeSphereContactsControlCode (arg of type int, dGeomColliderMergeContactsValue_*)
  • dGeomColliderGetMergeSphereContactsControlCode (arg of type int, dGeomColliderMergeContactsValue_*)
  • Parameters:
    controlClass - the control class
    controlCode - the control code for the class
    dataValue - the control argument pointer
    dataSize - the control argument size provided or expected
    Returns:
    Boolean execution status

    getRelPointPos

    void getRelPointPos(double px,
                        double py,
                        double pz,
                        DVector3 result)
    Get world position of a relative point on geom. Calling this function on a non-placeable geom results in the same point being returned.

    Parameters:
    result - will contain the result.

    getPosRelPoint

    void getPosRelPoint(double px,
                        double py,
                        double pz,
                        DVector3 result)
    Takes a point in global coordinates and returns the point's position in geom-relative coordinates. Calling this function on a non-placeable geom results in the same point being returned.

    Parameters:
    result - will contain the result.
    Remark:
    This is the inverse of dGeomGetRelPointPos()

    vectorToWorld

    void vectorToWorld(double px,
                       double py,
                       double pz,
                       DVector3 result)
    Convert from geom-local to world coordinates. Calling this function on a non-placeable geom results in the same vector being returned.

    Parameters:
    result - will contain the result.

    vectorFromWorld

    void vectorFromWorld(double px,
                         double py,
                         double pz,
                         DVector3 result)
    Convert from world to geom-local coordinates. Calling this function on a non-placeable geom results in the same vector being returned.

    Parameters:
    result - will contain the result.

    getOffsetPosition

    DVector3C getOffsetPosition()
    Get the offset position vector of a geom.

    Returns the positional offset of the geom in local coordinates. If the geom has no offset, this function returns the zero vector.

    Returns:
    A pointer to the geom's offset vector.
    Remark:
    The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

    copyOffsetPosition

    void copyOffsetPosition(DVector3 pos)
    Copy the offset position vector of a geom.

    Returns the positional offset of the geom in local coordinates. If the geom has no offset, this function returns the zero vector.

    Parameters:
    pos - returns the offset position

    setOffsetPosition

    void setOffsetPosition(double x,
                           double y,
                           double z)
    Set the local offset position of a geom from its body.

    Sets the geom's positional offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    x - the new X coordinate.
    y - the new Y coordinate.
    z - the new Z coordinate.

    getOffsetRotation

    DMatrix3C getOffsetRotation()
    Get the offset rotation matrix of a geom.

    Returns the rotational offset of the geom in local coordinates. If the geom has no offset, this function returns the identity matrix.

    Returns:
    A pointer to the geom's offset rotation matrix.
    Remark:
    The returned value is a pointer to the geom's internal data structure. It is valid until any changes are made to the geom.

    copyOffsetRotation

    void copyOffsetRotation(DMatrix3 R)
    Copy the offset rotation matrix of a geom.

    Returns the rotational offset of the geom in local coordinates. If the geom has no offset, this function returns the identity matrix.

    Parameters:
    R - returns the rotation matrix.

    setOffsetRotation

    void setOffsetRotation(DMatrix3C R)
    Set the local offset rotation matrix of a geom from its body.

    Sets the geom's rotational offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    R - the new rotation matrix.

    getOffsetQuaternion

    void getOffsetQuaternion(DQuaternion result)
    Get the offset rotation quaternion of a geom. Returns the rotation offset of the geom as a quaternion. If the geom has no offset, the identity quaternion is returned.

    Parameters:
    result - a copy of the rotation quaternion.

    setOffsetQuaternion

    void setOffsetQuaternion(DQuaternionC q)
    Set the local offset rotation of a geom from its body.

    Sets the geom's rotational offset in local coordinates. After this call, the geom will be at a new position determined from the body's position and the offset. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    q - the new rotation.

    setOffsetWorldPosition

    void setOffsetWorldPosition(double x,
                                double y,
                                double z)
    Set the offset position of a geom from its body.

    Sets the geom's positional offset to move it to the new world coordinates. After this call, the geom will be at the world position passed in, and the offset will be the difference from the current body position. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    x - the new X coordinate.
    y - the new Y coordinate.
    z - the new Z coordinate.

    setOffsetWorldRotation

    void setOffsetWorldRotation(DMatrix3C R)
    Set the offset rotation of a geom from its body.

    Sets the geom's rotational offset to orient it to the new world rotation matrix. After this call, the geom will be at the world orientation passed in, and the offset will be the difference from the current body orientation. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    R - the new rotation matrix.

    setOffsetWorldQuaternion

    void setOffsetWorldQuaternion(DQuaternionC q)
    Set the offset rotation of a geom from its body.

    Sets the geom's rotational offset to orient it to the new world rotation matrix. After this call, the geom will be at the world orientation passed in, and the offset will be the difference from the current body orientation. The geom must be attached to a body. If the geom did not have an offset, it is automatically created.

    Parameters:
    q - the new rotation.

    clearOffset

    void clearOffset()
    Clear any offset from the geom.

    If the geom has an offset, it is eliminated and the geom is repositioned at the body's position. If the geom has no offset, this function does nothing. This is more efficient than calling dGeomSetOffsetPosition(zero) and dGeomSetOffsetRotation(identiy), because this function actually eliminates the offset, rather than leaving it as the identity transform.


    isOffset

    boolean isOffset()
    Check to see whether the geom has an offset.

    This function will return non-zero if the offset has been created. Note that there is a difference between a geom with no offset, and a geom with an offset that is the identity transform. In the latter case, although the observed behaviour is identical, there is a unnecessary computation involved because the geom will be applying the transform whenever it needs to recalculate its world position.

    Returns:
    Non-zero if the geom has an offset, zero otherwise.