net.phys2d.raw
Class Arbiter

java.lang.Object
  extended bynet.phys2d.raw.Arbiter

public class Arbiter
extends java.lang.Object

A arbiter resolving contacts between a pair of bodies


Field Summary
static int MAX_POINTS
          The maximum number of points of contact
 
Method Summary
 void collide(float dt)
          Perform the collision analysis between the two bodies arbitrated
 boolean concerns(Body body)
          Check if this arbiter affects the specified body
 boolean equals(java.lang.Object other)
           
 Body getBody1()
          Get the first of the two bodies handled by this arbiter
 Body getBody2()
          Get the second of the two bodies handled by this arbiter
 Contact[] getContacts()
          Retrieve the contacts being resolved by this arbiter
protected  float getEnergy(Body body1, Body body2)
          Get the energy contained within 2 bodies
 int getNumContacts()
          The number of contacts being resolved by this arbiter
 int hashCode()
           
 boolean hasRestingPair()
          Check if this arbiter has two bodies that are resting
 void init()
          Initialise state for this arbiter - this is only done once per pair of bodies.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_POINTS

public static final int MAX_POINTS
The maximum number of points of contact

See Also:
Constant Field Values
Method Detail

hasRestingPair

public boolean hasRestingPair()
Check if this arbiter has two bodies that are resting

Returns:
True if the arbiter has two bodies that are "at rest"

collide

public void collide(float dt)
Perform the collision analysis between the two bodies arbitrated

Parameters:
dt - The amount of time passed since last collision check

init

public void init()
Initialise state for this arbiter - this is only done once per pair of bodies. It's used to caculated static data between them


getContacts

public Contact[] getContacts()
Retrieve the contacts being resolved by this arbiter

Returns:
The contacts being resolved by this arbiter

getNumContacts

public int getNumContacts()
The number of contacts being resolved by this arbiter

Returns:
The number of contacts being resolve by this arbiter

getBody1

public Body getBody1()
Get the first of the two bodies handled by this arbiter

Returns:
The first of the two bodies handled by this arbiter

getBody2

public Body getBody2()
Get the second of the two bodies handled by this arbiter

Returns:
The second of the two bodies handled by this arbiter

concerns

public boolean concerns(Body body)
Check if this arbiter affects the specified body

Parameters:
body - The body to check for
Returns:
True if this arbiter effects the body

getEnergy

protected float getEnergy(Body body1,
                          Body body2)
Get the energy contained within 2 bodies

Parameters:
body1 - The first body
body2 - The second body
Returns:
The energy contained

hashCode

public int hashCode()
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object other)
See Also:
Object.equals(java.lang.Object)