vooga.physicsEngine
Class Arbiter

java.lang.Object
  extended by vooga.physicsEngine.Arbiter

public class Arbiter
extends java.lang.Object

A class representing contact between two physical bodies (PhysicalParameters). This resolves the forces exerted by the two bodies. As a simplifying approximation, the Arbiter position is defined as the centroid of the points of intersection of the two bodies contact points. This class utilizes geometry.intersections.Intersector to find the points of intersection between two physical bodies.

Author:
Peng Shi

Constructor Summary
Arbiter(PhysicalParameters bodyA, PhysicalParameters bodyB, java.util.List<Vector2f> pointsOfContact, Vector2f normalDirection)
          Create an arbiter (representing contact) between bodyA and bodyB at idealized contact point pointOfContact.
 
Method Summary
 void applyImpulse()
          Apply the impulse accumulated at this arbiter back to the participatory bodies.
 PhysicalParameters getBody1()
           
 PhysicalParameters getBody2()
           
 Vector2f getNormal()
           
 java.util.List<Vector2f> getPointsOfContact()
          Get the list of intersection points detected that define the Arbiter
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arbiter

public Arbiter(PhysicalParameters bodyA,
               PhysicalParameters bodyB,
               java.util.List<Vector2f> pointsOfContact,
               Vector2f normalDirection)
Create an arbiter (representing contact) between bodyA and bodyB at idealized contact point pointOfContact. (We approximate all interactions between two bodies as having 1 idealized contact point.) The normalDirection should be set a vector normal to the contact between the two bodies. If the normal vector is 0, this picks the default value of (0,1). This constructor makes copies for all the given parameters.

Parameters:
bodyA -
bodyB -
normalDirection -
Method Detail

getPointsOfContact

public java.util.List<Vector2f> getPointsOfContact()
Get the list of intersection points detected that define the Arbiter

Returns:

getNormal

public Vector2f getNormal()
Returns:
the normal unit vector pointing toward bodyA

getBody1

public PhysicalParameters getBody1()
Returns:
first body that the Arbiter deals with.

getBody2

public PhysicalParameters getBody2()
Returns:
first body that the Arbiter deals with.

applyImpulse

public void applyImpulse()
Apply the impulse accumulated at this arbiter back to the participatory bodies. This is where most of the work is done.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object