org.odejava
Class JointHinge

java.lang.Object
  extended by org.odejava.Joint
      extended by org.odejava.JointHinge

public class JointHinge
extends Joint

Represents a joint that is restricted to a single degree of freedom around a hinge axis between two bodies.

Created 20.12.2003 (dd.mm.yyyy)

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

Field Summary
 
Fields inherited from class org.odejava.Joint
body1, body2, BOUNCE_RANGE_MSG, deleted, feedback, group, jointGroupId, jointId, name
 
Constructor Summary
JointHinge(String name, World world)
          Create a new Hinge joint that belongs to the given world and has a name.
JointHinge(String name, World world, JointGroup jointGroup)
          Create a new Hinge joint that belongs to the given world.
JointHinge(World world)
          Create a new Hinge joint that belongs to the given world and does not belong to any group.
JointHinge(World world, JointGroup jointGroup)
          Create a new Hinge joint that belongs to the given world.
 
Method Summary
 org.openmali.vecmath2.Vector3f getAnchor()
           
 void getAnchor(float[] result)
          Get the anchor location the joint, relative to body 1 and place it in the user-provided array.
<T extends org.openmali.vecmath2.Tuple3f>
T
getAnchor(T result)
          Get the anchor location the joint, relative to body 1 and place it in the user-provided array.
 org.openmali.vecmath2.Vector3f getAnchor2()
           
 void getAnchor2(float[] result)
          Get the anchor location the joint, relative to body 2 and place it in the user-provided array.
 float getAngle()
           
 float getAngleRate()
           
 org.openmali.vecmath2.Vector3f getAxis()
           
 float getConstantForceMix()
          Get the amount of the constant force mix parameter currently set for positions between the two stops.
 float getMaxAngleStop()
          Fetch the currently set maximum angle stop from this joint.
 float getMinAngleStop()
          Fetch the currently set maximum angle stop from this joint.
 float getParam(int parameter)
          Get an unchecked parameter value directly from this joint.
 float getStopBounce()
          Fetch the current bounce factor for the hinge stop.
 float getStopCFM()
          Get the amount of the stop constant force mix parameter currently set.
 float getStopERP()
          Get the amount of the stop error reduction parameter currently set.
 void setAnchor(float x, float y, float z)
           
 void setAxis(float x, float y, float z)
          Deprecated. use setAxis1 instead
 void setAxis1(float x, float y, float z)
           
 void setConstantForceMix(float force)
          Set the amount of constant force to mix into the system when the bodies are not at a stop.
 void setMaxAngleStop(float angle)
          Set the maximum angle that this joint is permitted to rotate to.
 void setMinAngleStop(float angle)
          Set the minimum angle that this joint is permitted to rotate to.
 void setParam(int parameter, float value)
          Set a generic, unchecked, parameter directly for this joint.
 void setStopBounce(float bounce)
          Set the bounciness of the stops.
 void setStopCFM(float force)
          Set the amount of stop constant force to mix into the system when the bodies reach a stop.
 void setStopERP(float erp)
          Set the amount of stop bounce error reduction.
 
Methods inherited from class org.odejava.Joint
attach, delete, enableFeedbackTracking, enableFeedbackTracking, getBody1, getBody2, getFeedback, getGroup, getName, isFeedbackTrackingEnabled, setAxis2, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JointHinge

public JointHinge(World world)
Create a new Hinge joint that belongs to the given world and does not belong to any group. The name is set to the null string.

Parameters:
world - The world that this belongs to

JointHinge

public JointHinge(String name,
                  World world)
Create a new Hinge joint that belongs to the given world and has a name. The name parameter is optional. The joint is attached to the global environment.

Parameters:
name - A label string to associate with this joint
world - The world that this belongs to

JointHinge

public JointHinge(World world,
                  JointGroup jointGroup)
Create a new Hinge joint that belongs to the given world. The JointGroup is optional and the name is set to the null string. If no group is provided, the joint is attached to the global environment.

Parameters:
world - The world that this belongs to
jointGroup - An optional group to associate this joint with

JointHinge

public JointHinge(String name,
                  World world,
                  JointGroup jointGroup)
Create a new Hinge joint that belongs to the given world. The JointGroup and name parameters are optional. If no group is provided, the joint is attached to the global environment.

Parameters:
name - A label string to associate with this joint
world - The world that this belongs to
jointGroup - An optional group to associate this joint with
Method Detail

setAnchor

public void setAnchor(float x,
                      float y,
                      float z)

getAnchor

public org.openmali.vecmath2.Vector3f getAnchor()

getAnchor

public void getAnchor(float[] result)
Get the anchor location the joint, relative to body 1 and place it in the user-provided array.

Parameters:
result - An object to place the values into

getAnchor

public <T extends org.openmali.vecmath2.Tuple3f> T getAnchor(T result)
Get the anchor location the joint, relative to body 1 and place it in the user-provided array.

Parameters:
result - An object to place the values into

getAnchor2

public org.openmali.vecmath2.Vector3f getAnchor2()

getAnchor2

public void getAnchor2(float[] result)
Get the anchor location the joint, relative to body 2 and place it in the user-provided array.

Parameters:
result - An object to place the values into

setAxis1

public void setAxis1(float x,
                     float y,
                     float z)
Overrides:
setAxis1 in class Joint

setAxis

@Deprecated
public void setAxis(float x,
                               float y,
                               float z)
Deprecated. use setAxis1 instead

Parameters:
x -
y -
z -

getAxis

public org.openmali.vecmath2.Vector3f getAxis()

getAngle

public float getAngle()

getAngleRate

public float getAngleRate()

setConstantForceMix

public void setConstantForceMix(float force)
Set the amount of constant force to mix into the system when the bodies are not at a stop. This value has no effect when the bodies are at one of the two stops.

Parameters:
force - The amount of force to use

getConstantForceMix

public float getConstantForceMix()
Get the amount of the constant force mix parameter currently set for positions between the two stops.

Returns:
The current constant force mix

setMinAngleStop

public void setMinAngleStop(float angle)
                     throws IllegalArgumentException
Set the minimum angle that this joint is permitted to rotate to. Angles are specified relative to the initial position that the joint was created in. The angle value is limited to the range +/- π. If the the provided angle is out of this range, an exception is thrown.

Note that if the maximum angle provided is less than the minimum angle at the point of evaluation, ODE ignores all limits.

A value of Float.NEGATIVE_INFINITY can be used to disable the maximum stop.

Parameters:
angle - The minimum stop angle in radians [-π,+π] or Float.NEGATIVE_INFINITY
Throws:
IllegalArgumentException - The provided angle is out of the valid range

getMinAngleStop

public float getMinAngleStop()
Fetch the currently set maximum angle stop from this joint.

Returns:
A angle in radians in the range [-π,+π] or Float.NEGATIVE_INFINITY

setMaxAngleStop

public void setMaxAngleStop(float angle)
                     throws IllegalArgumentException
Set the maximum angle that this joint is permitted to rotate to. Angles are specified relative to the initial position that the joint was created in. The angle value is limited to the range +/- π. If the the provided angle is out of this range, an exception is thrown.

Note that if the maximum angle provided is less than the minimum angle at the point of evaluation, ODE ignores all limits.

A value of Float.POSITIVE_INFINITY can be used to disable the maximum stop.

Parameters:
angle - The maximum stop angle in radians [-π,+π] or Float.POSITIVE_INFINITY
Throws:
IllegalArgumentException - The provided angle is out of the valid range

getMaxAngleStop

public float getMaxAngleStop()
Fetch the currently set maximum angle stop from this joint.

Returns:
A angle in radians in the range [-π,+π] or Float.POSITIVE_INFINITY

setStopBounce

public void setStopBounce(float bounce)
                   throws IllegalArgumentException
Set the bounciness of the stops. This is a value in the range [0,1] defining how hitting the stop will effect the return travel of the two bodies. A value of 0 means there is no bounce and the bodies will not bounce back. A value of 1 means the full contact velocity at the stop will be reflected back in the opposite direction.

Parameters:
bounce - The bounciness factor in the range [0,1]
Throws:
IllegalArgumentException - The bounce factor is out of range

getStopBounce

public float getStopBounce()
Fetch the current bounce factor for the hinge stop.

Returns:
The bounce factor as a value in the range [0,1]

setStopERP

public void setStopERP(float erp)
Set the amount of stop bounce error reduction. This value should be between 0 and 1. 0 is no reduction at all, 1 is full correction in a single step.

Parameters:
erp - The amount of error reduction to use

getStopERP

public float getStopERP()
Get the amount of the stop error reduction parameter currently set. This value will be between 0 and 1. 0 is no bounce at all, 1 is full bounce.

Returns:
A value between 0 and 1

setStopCFM

public void setStopCFM(float force)
Set the amount of stop constant force to mix into the system when the bodies reach a stop. This value has no effect when the bodies are not at the stops. Together with the ERP value, this can be used to get spongy or soft stops. Note that this is inteded for unpowered joints, it does not work as expected on powered joints.

Parameters:
force - The amount of force to use

getStopCFM

public float getStopCFM()
Get the amount of the stop constant force mix parameter currently set.

Returns:
The current constant force mix at the stops

setParam

public void setParam(int parameter,
                     float value)
Set a generic, unchecked, parameter directly for this joint. The parameter types that are permissable for the joint are defined by the individual joint classes and the definitions can be found in OdeConstants.

Overrides:
setParam in class Joint
Parameters:
parameter - A parameter constant from OdeConstants
value - The new value to associate with the parameter

getParam

public float getParam(int parameter)
Get an unchecked parameter value directly from this joint. The parameter types that are permissable for the joint are defined by the individual joint classes and the definitions can be found in OdeConstants.

Overrides:
getParam in class Joint
Parameters:
parameter - A constant describing the parameter to fetch
Returns:
The value of that parameter