org.jbox2d.dynamics.joints
Class GearJoint

java.lang.Object
  extended by org.jbox2d.dynamics.joints.Joint
      extended by org.jbox2d.dynamics.joints.GearJoint

public class GearJoint
extends Joint

A gear joint is used to connect two joints together. Either joint can be a revolute or prismatic joint. You specify a gear ratio to bind the motions together: coordinate1 + ratio * coordinate2 = constant The ratio can be negative or positive. If one joint is a revolute joint and the other joint is a prismatic joint, then the ratio will have units of length or units of 1/length.
Warning: The revolute and prismatic joints must be attached to fixed bodies (which must be body1 on those joints).


Field Summary
 float m_constant
           
 Body m_ground1
           
 Body m_ground2
           
 Vec2 m_groundAnchor1
           
 Vec2 m_groundAnchor2
           
 Jacobian m_J
           
 Vec2 m_localAnchor1
           
 Vec2 m_localAnchor2
           
 PrismaticJoint m_prismatic1
           
 PrismaticJoint m_prismatic2
           
 float m_ratio
           
 RevoluteJoint m_revolute1
           
 RevoluteJoint m_revolute2
           
 
Fields inherited from class org.jbox2d.dynamics.joints.Joint
m_body1, m_body2, m_collideConnected, m_islandFlag, m_next, m_node1, m_node2, m_prev, m_type, m_userData
 
Constructor Summary
GearJoint(GearJointDef def)
           
 
Method Summary
 Vec2 getAnchor1()
          Get the anchor point on body1 in world coordinates.
 Vec2 getAnchor2()
          Get the anchor point on body2 in world coordinates.
 float getRatio()
           
 Vec2 getReactionForce()
          Get the reaction force on body2 at the joint anchor.
 float getReactionTorque()
          Get the reaction torque on body2.
 void initVelocityConstraints(TimeStep step)
           
 boolean solvePositionConstraints()
          This returns true if the position errors are within tolerance.
 void solveVelocityConstraints(TimeStep step)
           
 
Methods inherited from class org.jbox2d.dynamics.joints.Joint
create, destroy, destructor, getBody1, getBody2, getNext, getType, getUserData, initPositionConstraints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_ground1

public Body m_ground1

m_ground2

public Body m_ground2

m_revolute1

public RevoluteJoint m_revolute1

m_prismatic1

public PrismaticJoint m_prismatic1

m_revolute2

public RevoluteJoint m_revolute2

m_prismatic2

public PrismaticJoint m_prismatic2

m_groundAnchor1

public Vec2 m_groundAnchor1

m_groundAnchor2

public Vec2 m_groundAnchor2

m_localAnchor1

public Vec2 m_localAnchor1

m_localAnchor2

public Vec2 m_localAnchor2

m_J

public Jacobian m_J

m_constant

public float m_constant

m_ratio

public float m_ratio
Constructor Detail

GearJoint

public GearJoint(GearJointDef def)
Method Detail

initVelocityConstraints

public void initVelocityConstraints(TimeStep step)
Specified by:
initVelocityConstraints in class Joint

solveVelocityConstraints

public void solveVelocityConstraints(TimeStep step)
Specified by:
solveVelocityConstraints in class Joint

solvePositionConstraints

public boolean solvePositionConstraints()
Description copied from class: Joint
This returns true if the position errors are within tolerance.

Specified by:
solvePositionConstraints in class Joint

getAnchor1

public Vec2 getAnchor1()
Description copied from class: Joint
Get the anchor point on body1 in world coordinates.

Specified by:
getAnchor1 in class Joint

getAnchor2

public Vec2 getAnchor2()
Description copied from class: Joint
Get the anchor point on body2 in world coordinates.

Specified by:
getAnchor2 in class Joint

getReactionForce

public Vec2 getReactionForce()
Description copied from class: Joint
Get the reaction force on body2 at the joint anchor.

Specified by:
getReactionForce in class Joint

getReactionTorque

public float getReactionTorque()
Description copied from class: Joint
Get the reaction torque on body2.

Specified by:
getReactionTorque in class Joint

getRatio

public float getRatio()