edu.eside.flingbox.physics
Class PhysicPolygon

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

public class PhysicPolygon
extends PhysicBody

Implements physics properties for polygols.


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.eside.flingbox.physics.PhysicBody
PhysicBody.OnMovementListener
 
Field Summary
static float INFINITE_MASS
          Objects with INFINITE_MASS should be impossible to move
 
Fields inherited from class edu.eside.flingbox.physics.PhysicBody
INFINITE_ANGULAR_MASS
 
Constructor Summary
PhysicPolygon(Vector2D[] points, float bodyMass, Vector2D position, PhysicBody.OnMovementListener listener)
          Constructor physics for default polygon.
 
Method Summary
 void applyImpulse(Vector2D impulse)
          Applies force to the object
 boolean contains(Vector2D p)
          Check if point is contained by the polygon
 float getBodyMass()
           
 float getDynamicFrictionCoeficient()
           
 Vector2D getImpulse()
           
 Vector2D getPosition()
           
 float getRestitutionCoeficient()
           
 float getStaticFrictionCoeficient()
           
 boolean isEnabled()
           
 void setDensity(float density)
           
 void setDynamicFrictionCoeficient(float f)
           
 void setEnabled(boolean doEnable)
          Sets if object is enabled or not
 void setPosition(float x, float y)
           
 void setPosition(Vector2D v)
           
 void setRestitutionCoeficient(float restCoef)
          Sets body's Restitution Coeficient
 void setStaticFrictionCoeficient(float f)
           
 
Methods inherited from class edu.eside.flingbox.physics.PhysicBody
applyImpulse, getAngle, getAngularMass, getAngularVelocity, getCollider, getDensity, getEnergy, getVelocity, isFixed, onUpdateBody, setAngle, setBodyFixed, setVelocity
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITE_MASS

public static final float INFINITE_MASS
Objects with INFINITE_MASS should be impossible to move

See Also:
Constant Field Values
Constructor Detail

PhysicPolygon

public PhysicPolygon(Vector2D[] points,
                     float bodyMass,
                     Vector2D position,
                     PhysicBody.OnMovementListener listener)
Constructor physics for default polygon.

Parameters:
points - polygon's points
bodyMass - polygon's mass
position - Polygon's start position
listener - Lister to be called when movement occurs
Method Detail

contains

public boolean contains(Vector2D p)
Check if point is contained by the polygon

Parameters:
p - point to check
Returns:
true if is containded

setDensity

public void setDensity(float density)
Overrides:
setDensity in class PhysicBody

applyImpulse

public void applyImpulse(Vector2D impulse)
Applies force to the object

Parameters:
force - Force
dt - time period while force is applied

getImpulse

public Vector2D getImpulse()

isEnabled

public boolean isEnabled()
Returns:
true if is enabled

setEnabled

public void setEnabled(boolean doEnable)
Sets if object is enabled or not


getPosition

public Vector2D getPosition()
Specified by:
getPosition in interface PositionComparator.Positionable
Returns:
Body's absolute position

setPosition

public void setPosition(float x,
                        float y)
Parameters:
position - new postion of the object

setPosition

public void setPosition(Vector2D v)
Parameters:
position - new postion of the object

getBodyMass

public float getBodyMass()
Returns:
Body's mass

getDynamicFrictionCoeficient

public float getDynamicFrictionCoeficient()

setDynamicFrictionCoeficient

public void setDynamicFrictionCoeficient(float f)

getStaticFrictionCoeficient

public float getStaticFrictionCoeficient()

setStaticFrictionCoeficient

public void setStaticFrictionCoeficient(float f)

getRestitutionCoeficient

public float getRestitutionCoeficient()
Returns:
body's Restitution Coeficient

setRestitutionCoeficient

public void setRestitutionCoeficient(float restCoef)
Sets body's Restitution Coeficient