org.odejava
Class Odejava

java.lang.Object
  extended by org.odejava.Odejava

public class Odejava
extends Object

Odejava physics engine core class. This class contains helper methods and general simulation parameters. API is likely to change as common parameter issues and callback routine handling is changed on Odejava. Also swig type helpers become obsolete when Odejava.i can return proper java objects directly.

Odejava API is divided in two different interfaces.

Low level API: This Java API is one to one with ODE's main C API. All ODE's functions are supported on low level API. ODE's own documentation at q12.org/ode can be used directly as the Java API is almost identical. This API is works very well and has best performance. This API is generated using Swig tool and it is easy to regenerate in the future if ODE's own API changes. See class org.odejava.ode.

High level API: Proper Java API which is easy to use. This depends to low level API. This is initial version and bound to change. However, I encourage developers to use this this API as much as possible. When needed, high level API can be extended with low level API. See package org.odejava.

Created 16.12.2003 (dd.mm.yyyy)

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

Field Summary
static Logger log
           
 
Method Summary
static void createContactJoints(SWIGTYPE_p_dWorldID worldId, SWIGTYPE_p_dJointGroupID contactGroupId)
          Adds all contact joints to contact jointgroup.
static float[] createJavaArray(SWIGTYPE_p_float swigArray, int length)
          Create java float array based on given swig array.
static int[] createJavaArray(SWIGTYPE_p_int swigArray, int length)
          Create java int array based on given swig array.
static SWIGTYPE_p_float createSwigArray(float[] javaArray)
          Create swig float array based on given java array.
static SWIGTYPE_p_float createSwigArray(FloatBuffer buffer, int length)
          Create swig float array based on given java buffer.
static SWIGTYPE_p_int createSwigArray(int[] javaArray)
          Create swig int array based on given java array.
static SWIGTYPE_p_int createSwigArray(IntBuffer buffer, int length)
          Create swig int array based on given java buffer.
static SWIGTYPE_p_float createSwigFloatArray(int length)
          Create swig float array with given length.
static SWIGTYPE_p_int createSwigIntArray(int length)
          Create swig int array with given length.
static ByteBuffer getContactFloatBuf()
          Obtain contact buffer.
static ByteBuffer getContactIntBuf()
          Obtain contact buffer.
static String getLibraryVersion()
          Returns odejava library version
static long getNativeAddr(long swigCPtr)
           
static void init()
          Initializes Odejava and checks for issues with the natives.
static void setMaxCallbackContactGeoms(int size)
           
static void setMaxContactGeomsPerNearcallback(int size)
          Sets how many contact geoms will be generated per dCollide (nearCallback) call.
static void setMaxStepContacts(int maxSize)
          Set collision parameter:
static int spaceCollide2(long spaceGeomAddr1, long spaceGeomAddr2)
          Collide space/geom into space/geom with nearCallback function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final Logger log
Method Detail

getNativeAddr

public static long getNativeAddr(long swigCPtr)

init

public static void init()
                 throws UnsupportedOperationException
Initializes Odejava and checks for issues with the natives.

Throws:
UnsupportedOperationException - if library was not initialized successfully

getLibraryVersion

public static String getLibraryVersion()
Returns odejava library version

Returns:
version

createSwigArray

public static SWIGTYPE_p_float createSwigArray(float[] javaArray)
Create swig float array based on given java array.

Parameters:
javaArray -
Returns:
swig float array

createSwigFloatArray

public static SWIGTYPE_p_float createSwigFloatArray(int length)
Create swig float array with given length.

Parameters:
length - length of the array
Returns:
swig float array

createSwigIntArray

public static SWIGTYPE_p_int createSwigIntArray(int length)
Create swig int array with given length.

Parameters:
length - length of the array
Returns:
swig int array

createJavaArray

public static float[] createJavaArray(SWIGTYPE_p_float swigArray,
                                      int length)
Create java float array based on given swig array.

Parameters:
swigArray -
length -
Returns:
java float array

createSwigArray

public static SWIGTYPE_p_int createSwigArray(int[] javaArray)
Create swig int array based on given java array.

Parameters:
javaArray -
Returns:
swig int array

createSwigArray

public static SWIGTYPE_p_int createSwigArray(IntBuffer buffer,
                                             int length)
Create swig int array based on given java buffer. The buffer must already be positioned appropriately.

Parameters:
buffer - nio buffer to be copied
length - size of the new swig array
Returns:
swig int array

createSwigArray

public static SWIGTYPE_p_float createSwigArray(FloatBuffer buffer,
                                               int length)
Create swig float array based on given java buffer. The buffer must already be positioned appropriately.

Parameters:
buffer - nio buffer to be copied
length - size of the new swig array
Returns:
swig float array

createJavaArray

public static int[] createJavaArray(SWIGTYPE_p_int swigArray,
                                    int length)
Create java int array based on given swig array.

Parameters:
swigArray -
length -
Returns:
java int array

setMaxCallbackContactGeoms

public static void setMaxCallbackContactGeoms(int size)

setMaxContactGeomsPerNearcallback

public static void setMaxContactGeomsPerNearcallback(int size)
Sets how many contact geoms will be generated per dCollide (nearCallback) call. Smaller values make simulation faster, larger values better simulation. Default size is 12.

Parameters:
size -

setMaxStepContacts

public static void setMaxStepContacts(int maxSize)
Set collision parameter:

Parameters:
maxSize - maximum number of contacts per simulation step and geom

spaceCollide2

public static int spaceCollide2(long spaceGeomAddr1,
                                long spaceGeomAddr2)
Collide space/geom into space/geom with nearCallback function.

Parameters:
spaceGeomAddr1 - space/geom pointer 1
spaceGeomAddr2 - space/geom pointer 2
Returns:
number of contacts

createContactJoints

public static void createContactJoints(SWIGTYPE_p_dWorldID worldId,
                                       SWIGTYPE_p_dJointGroupID contactGroupId)
Adds all contact joints to contact jointgroup. Call this after spaceCollide call if you are not creating contact joints manually at the Java side.

Parameters:
worldId -
contactGroupId -

getContactIntBuf

public static ByteBuffer getContactIntBuf()
Obtain contact buffer.

Contact data can be accessed through DirectBuffers. Collision.collide() calls write to these buffers. We use two different, float and int, buffers for enabling array access and bulk transfers.

Returns:
contact int buffer

getContactFloatBuf

public static ByteBuffer getContactFloatBuf()
Obtain contact buffer.

Returns:
contact float buffer