org.starhope.appius.physica
Class RigidBody

java.lang.Object
  extended by org.starhope.appius.physica.RigidBody

public class RigidBody
extends Object

WRITEME: Document this type.

Author:
ewinkelman

Constructor Summary
RigidBody()
           
 
Method Summary
static void collide(Collidable obj1, Collidable obj2, long timeIndex)
          Collides two objects.
static Vector2D[] conserveMomentum(Vector2D myVelocity, Vector2D otherVelocity, double myMass, double otherMass, double cor)
          Velocity change equation for conserving momentum between two objects
static Vector2D findComponent(Vector2D incident, Vector2D normal)
          Finds the vector component of the incident vector in the normal vector
static Collection<Point2D> getCollisionPoints(GeneralPath path1, GeneralPath path2)
           
static boolean hasCollision(GeneralPath path1, GeneralPath path2)
          Gets a set of all current collision points between two objects
static Vector2D Reflect(Vector2D incident, Vector2D normal)
          Reflects a vector around a normal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RigidBody

public RigidBody()
Method Detail

collide

public static void collide(Collidable obj1,
                           Collidable obj2,
                           long timeIndex)
                    throws GameLogicException
Collides two objects. If the two objects are not in a collision state it leaves them unchanged.

Parameters:
obj1 - First object in the collision
obj2 - Second object in the collision
timeIndex - Time index of the collision
Throws:
GameLogicException - WRITEME

conserveMomentum

public static final Vector2D[] conserveMomentum(Vector2D myVelocity,
                                                Vector2D otherVelocity,
                                                double myMass,
                                                double otherMass,
                                                double cor)
Velocity change equation for conserving momentum between two objects

Parameters:
myVelocity - Main object's velocity
otherVelocity - Other object's velocity
myMass - Main object's mass
otherMass - Other object's mass
cor - Coefficient of Restitution
Returns:
A pair of vectors with the new velocities for object 1 and object 2

findComponent

public static Vector2D findComponent(Vector2D incident,
                                     Vector2D normal)
Finds the vector component of the incident vector in the normal vector

Parameters:
incident - Incident Vector
normal - Normal Vector
Returns:
The portion of the incident vector in the normal vector

getCollisionPoints

public static Collection<Point2D> getCollisionPoints(GeneralPath path1,
                                                     GeneralPath path2)
Parameters:
path1 - WRITEME
path2 - WRITEME
Returns:
WRITEME

hasCollision

public static boolean hasCollision(GeneralPath path1,
                                   GeneralPath path2)
Gets a set of all current collision points between two objects

Parameters:
path1 - Path of object one's collision boundaries
path2 - Path of object two's collision boundaries
Returns:
A set of points where the objects collide

Reflect

public static Vector2D Reflect(Vector2D incident,
                               Vector2D normal)
Reflects a vector around a normal

Parameters:
incident - Incident vector
normal - Normal vector
Returns:
The new incident vector