Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.eside.flingbox.physics
Class PhysicBody

    java.lang.Object
      edu.eside.flingbox.physics.PhysicBody

All Implemented Interfaces:
  PositionComparator.Positionable

Direct Known Subclasses:
  PhysicPolygon

    public abstract class PhysicBody

extends java.lang.Object

Abstract class with handles all properties that any physical body should have.

Nested Class Summary
`static interface` | `PhysicBody.OnMovementListener` Implements on move callback.

Field Summary
`static float` | `INFINITE_ANGULAR_MASS` Objects with INFINITE_ANGULAR_MASS should be imposible to rotate
`static float` | `INFINITE_MASS` Objects with INFINITE_MASS should be impossible to move

Method Summary
`void` | `applyImpulse(Vector2D impulse)` Applies force to the object
`void` | `applyImpulse(Vector2D impulse, Vector2D applicationPoint)` Applies force to the object
`boolean` | `contains(Vector2D p)` Check if point is contained by the polygon
`float` | `getAngle()`
`float` | `getAngularMass()`
`float` | `getAngularVelocity()`
`float` | `getBodyMass()`
`Collider` | `getCollider()`
`float` | `getDensity()`
`float` | `getDynamicFrictionCoeficient()`
`float` | `getEnergy()` Computes current object's energy
`Vector2D` | `getImpulse()`
`Vector2D` | `getPosition()`
`float` | `getRestitutionCoeficient()`
`float` | `getStaticFrictionCoeficient()`
`Vector2D` | `getVelocity()`
`boolean` | `isEnabled()`
`boolean` | `isFixed()`
`void` | `onUpdateBody(float time)` Called to refresh object's position
`void` | `setAngle(float angle)`
`void` | `setBodyFixed(boolean fixed)` Fixs body, making impossible to move
`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)`
`void` | `setVelocity(float vx, float vy)` Sets velocity components

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INFINITE_ANGULAR_MASS

    public static final float INFINITE_ANGULAR_MASS

  Objects with INFINITE_ANGULAR_MASS should be imposible to rotate

  See Also:
    Constant Field Values

### INFINITE_MASS

    public static final float INFINITE_MASS

  Objects with INFINITE_MASS should be impossible to move

  See Also:
    Constant Field Values

Method Detail

### onUpdateBody

    public void onUpdateBody(float time)

  Called to refresh object's position

  Parameters:
    `time` - in seconds since last update

### applyImpulse

    public void applyImpulse(Vector2D impulse,
                             Vector2D applicationPoint)

  Applies force to the object

  Parameters:
    `force` - Force
    `applicationPoint` - relative point in wich force is applied
    `dt` - time period while force is applied

### setBodyFixed

    public void setBodyFixed(boolean fixed)

  Fixs body, making impossible to move

### isFixed

    public boolean isFixed()

  Returns:
    true if body can is fixed

### getAngularMass

    public float getAngularMass()

  Returns:
    Body's angular mass

### getDensity

    public float getDensity()

### setDensity

    public void setDensity(float density)

### getVelocity

    public Vector2D getVelocity()

  Returns:
    velocity

### setVelocity

    public void setVelocity(float vx,
                            float vy)

  Sets velocity components

  Parameters:
    `vx` -
    `vy` -

### getAngularVelocity

    public float getAngularVelocity()

  Returns:
    Body's angular velocity

### getAngle

    public float getAngle()

  Returns:
    Body's angle

### setAngle

    public void setAngle(float angle)

  Parameters:
    `angle` - new object's angle

### getEnergy

    public float getEnergy()

  Computes current object's energy

  Returns:
    energy in juls

### getCollider

    public Collider getCollider()

  Returns:
    the Collider

### applyImpulse

    public void applyImpulse(Vector2D impulse)

  Applies force to the object

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

### contains

    public boolean contains(Vector2D p)

  Check if point is contained by the polygon

  Parameters:
    `p` - point to check
  Returns:
    true if is contained

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD