edu.eside.flingbox.physics.collisions
Class ColliderPolygon

java.lang.Object
  extended by edu.eside.flingbox.physics.collisions.Collider
      extended by edu.eside.flingbox.physics.collisions.ColliderPolygon
All Implemented Interfaces:
PhysicBody.OnMovementListener, PositionComparator.Positionable

public class ColliderPolygon
extends Collider
implements PhysicBody.OnMovementListener

Collider for a polygon. it handles all functions needed by Collision system NOTE This class should only be created by PhisicPolygon. How collision detector optimizer works: - When created collider check each polygon's vertex angle and stores them. - When bounding circle collides Collider checks only segments in other circle region.


Constructor Summary
ColliderPolygon(Vector2D[] contour, PhysicBody thisPhysic)
          Default constructor for a polygon collider.
 
Method Summary
 Contact[] checkContacts(Collider collider)
          Checks if objects can collide
 
Methods inherited from class edu.eside.flingbox.physics.collisions.Collider
canContact, getAssociatedBody, getBoundingCircle, getPosition, onMovement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.eside.flingbox.physics.PhysicBody.OnMovementListener
onMovement
 

Constructor Detail

ColliderPolygon

public ColliderPolygon(Vector2D[] contour,
                       PhysicBody thisPhysic)
Default constructor for a polygon collider.

Parameters:
contour - Polygon's points. It handles pointer in order to preserve recurses, so mPolygonContour should be automatically rotated. NOTE It has to be in counterclockwise ordering!!!
Method Detail

checkContacts

public Contact[] checkContacts(Collider collider)
Description copied from class: Collider
Checks if objects can collide

Specified by:
checkContacts in class Collider
Parameters:
collider - other objects collider.
Returns:
true if objects can collide