edu.eside.flingbox.physics.collisions
Class Contact

java.lang.Object
  extended by edu.eside.flingbox.physics.collisions.Contact
All Implemented Interfaces:
PositionComparator.Positionable

public class Contact
extends java.lang.Object
implements PositionComparator.Positionable

Class to handle contact between two bodies.


Field Summary
 PhysicBody collidedBody
          Collided body in contact, this is the weighter body in contact
 PhysicBody collidingBody
          Colliding body in contact, this is the body in contact
 Vector2D normal
          Contact's normal.
 Vector2D position
          Contact's absolute position
 Vector2D sense
          Contact's sense.
 
Constructor Summary
Contact(PhysicBody bodyA, PhysicBody bodyB, Vector2D position, Vector2D sense, Intersect intersect)
          Default constructor
 
Method Summary
 boolean concerns(PhysicBody body)
           
 Vector2D getBodysSide(PhysicBody body)
           
 Intersect getIntersect()
           
 Vector2D getPosition()
           
 Vector2D getRelativeVelocity()
           
 boolean isCollision()
           
 PhysicBody otherBody(PhysicBody body)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collidingBody

public final PhysicBody collidingBody
Colliding body in contact, this is the body in contact


collidedBody

public final PhysicBody collidedBody
Collided body in contact, this is the weighter body in contact


position

public final Vector2D position
Contact's absolute position


sense

public final Vector2D sense
Contact's sense. This is a normalized vector


normal

public final Vector2D normal
Contact's normal. This is a normalized vector

Constructor Detail

Contact

public Contact(PhysicBody bodyA,
               PhysicBody bodyB,
               Vector2D position,
               Vector2D sense,
               Intersect intersect)
Default constructor

Parameters:
bodyA -
bodyB -
position -
sense -
intersect -
Method Detail

getBodysSide

public Vector2D getBodysSide(PhysicBody body)

concerns

public boolean concerns(PhysicBody body)

otherBody

public PhysicBody otherBody(PhysicBody body)

getPosition

public Vector2D getPosition()
Specified by:
getPosition in interface PositionComparator.Positionable

getRelativeVelocity

public Vector2D getRelativeVelocity()

getIntersect

public Intersect getIntersect()

isCollision

public boolean isCollision()