net.phys2d.raw
Class AngleJoint

java.lang.Object
  extended bynet.phys2d.raw.AngleJoint
All Implemented Interfaces:
Joint

public class AngleJoint
extends java.lang.Object
implements Joint

A joint that constrains the angle two bodies can be at in relation to each other.


Constructor Summary
AngleJoint(Body body1, Body body2, Vector2f anchor1, Vector2f anchor2, float rotateA, float rotateB)
          Create a new angle joint
AngleJoint(Body body1, Body body2, Vector2f anchor1, Vector2f anchor2, float rotateA, float rotateB, float restitution)
          Create a new angle joint
 
Method Summary
 void applyImpulse()
          Apply the impulse caused by the joint to the bodies attached.
 Vector2f getAnchor1()
          Get the anchor of the joint on the first body
 Vector2f getAnchor2()
          Get the anchor of the joint on the second body
 Body getBody1()
          Get the first body attached to this joint
 Body getBody2()
          Get the second body attached to this joint
 float getRotateA()
          Get the upper angle bound
 float getRotateB()
          Get the lower angle bound
 void preStep(float invDT)
          Precaculate everything and apply initial impulse before the simulation step takes place
 void setRelaxation(float relaxation)
          Set the relaxtion value on this joint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AngleJoint

public AngleJoint(Body body1,
                  Body body2,
                  Vector2f anchor1,
                  Vector2f anchor2,
                  float rotateA,
                  float rotateB)
Create a new angle joint

Parameters:
body1 - The first body that is attached on the constraint
body2 - The second body that is attached on the constraint
anchor1 - The anchor point on first body
anchor2 - The anchor point on second body
rotateA - The higher angle bound for constraint
rotateB - The lower angle bound for constraint

AngleJoint

public AngleJoint(Body body1,
                  Body body2,
                  Vector2f anchor1,
                  Vector2f anchor2,
                  float rotateA,
                  float rotateB,
                  float restitution)
Create a new angle joint

Parameters:
body1 - The first body that is attached on the constraint
body2 - The second body that is attached on the constraint
anchor1 - The anchor point on first body
anchor2 - The anchor point on second body
rotateA - The higher angle bound for constraint
rotateB - The lower angle bound for constraint
restitution - The restitution when body bounce on either side
Method Detail

applyImpulse

public void applyImpulse()
Description copied from interface: Joint
Apply the impulse caused by the joint to the bodies attached.

Specified by:
applyImpulse in interface Joint
See Also:
Joint.applyImpulse()

getBody1

public Body getBody1()
Description copied from interface: Joint
Get the first body attached to this joint

Specified by:
getBody1 in interface Joint
Returns:
The first body attached to this joint
See Also:
Joint.getBody1()

getBody2

public Body getBody2()
Description copied from interface: Joint
Get the second body attached to this joint

Specified by:
getBody2 in interface Joint
Returns:
The second body attached to this joint
See Also:
Joint.getBody2()

preStep

public void preStep(float invDT)
Description copied from interface: Joint
Precaculate everything and apply initial impulse before the simulation step takes place

Specified by:
preStep in interface Joint
Parameters:
invDT - The amount of time the simulation is being stepped by
See Also:
Joint.preStep(float)

setRelaxation

public void setRelaxation(float relaxation)
Description copied from interface: Joint
Set the relaxtion value on this joint. This value determines how loose the joint will be

Specified by:
setRelaxation in interface Joint
Parameters:
relaxation - The relaxation value
See Also:
Joint.setRelaxation(float)

getRotateA

public float getRotateA()
Get the upper angle bound

Returns:
The upper angle bound

getRotateB

public float getRotateB()
Get the lower angle bound

Returns:
The lower angle bound

getAnchor1

public Vector2f getAnchor1()
Get the anchor of the joint on the first body

Returns:
The anchor of the joint on the first body

getAnchor2

public Vector2f getAnchor2()
Get the anchor of the joint on the second body

Returns:
The anchor of the joint on the second body