source.ucregents.playground.physics
Class RangedForceEntity

java.lang.Object
  extended by source.ucregents.playground.physics.BaseEntity
      extended by source.ucregents.playground.physics.MovingEntity
          extended by source.ucregents.playground.physics.RangedForceEntity
All Implemented Interfaces:
java.lang.Cloneable, IForceEntity
Direct Known Subclasses:
Planet3

public class RangedForceEntity
extends MovingEntity
implements IForceEntity

Ranged Force Entity is a force entity that has a force that pulls toward a point in space.


Constructor Summary
RangedForceEntity()
           
RangedForceEntity(double x, double y, double width, double height, double attractionStrength)
          The ranged force entity is a moving entity with the additional attribute of attraction strength
RangedForceEntity(double x, double y, double width, double height, float orientation, javax.vecmath.Vector2d inputVelocity, int inputMass, double attractionStrength)
          The ranged force entity is a moving entity with the additional attribute of attraction strength
RangedForceEntity(PolygonOrCircle forceShape, double attractionStrength)
          Constructs a new ranged force entity
RangedForceEntity(PolygonOrCircle forceShape, PolygonOrCircle entityShape, double attractionStrength)
          Constructs a new ranged force entity
 
Method Summary
 java.lang.Object clone()
          Clones the entity in its current state
 java.lang.String DefaultImageLocation()
          Provides the location of the default image
 void Draw(java.awt.Graphics2D g, boolean verbose)
          Draws the entity
 double getAttraction()
          Gets the attraction force
 javax.vecmath.Vector2d getForceFor(MovingEntity be)
          Gets the force vector to act on another entity
 boolean IntersectsWith(MovingEntity entity)
          Determines if it intersects with another entity
 boolean isCollidable()
          Determines whether or not this entity can be collided with by other entities.
protected  void OnLocationChange(double deltaX, double deltaY)
           
 void setAttraction(double f)
          Sets the attraction force
 
Methods inherited from class source.ucregents.playground.physics.MovingEntity
collide, collide, Deserialize, getAngularVelocity, getCurrentTickVelocity, getCurrentVelocity, getMass, increaseVelocity, increaseXVelocity, increaseYVelocity, isStationary, isUnstoppableForce, moveCurrentVelocity, moveVector, Serialize, setAngularVelocity, setCurrentTickVelocity, setCurrentVelocity, setMass, setStationary, setUnstoppableForce
 
Methods inherited from class source.ucregents.playground.physics.BaseEntity
calculateAxes, getActualFrameDimensions, getAxes, getAxesClone, getAxis, getBounciness, getCenterPoint, getDrawType, getEvents, getFrameColor, getFrictionConstant, getGradientColor, getImageOffset, getName, getOrientation, getResizingObject, getRoundedShapeMass, getScale, getShape, getShapeColor, getShapeFrame, getShapeMass, getSideVectors, getULPoint, getUserEvents, getVertexCount, getVerticesCoordinates, isCircle, isOverlapping, isPolygon, isSelected, isVisible, OnCenterScale, OnCollisionWith, OnOrientationChange, OnULScale, RegisterEvent, RegisterEvent, RegisterEvents, RemoveEvent, RemoveEvents, resetFrameColor, Scale, ScaleAroundCenter, setBounciness, setCenterPoint, setCenterPoint, setCollidable, setDrawType, setFrameColor, setFrictionConstant, setGradientColor, setImageOffset, setName, setOrientation, setScale, setSelected, setShapeColor, setULPoint, setULPoint, setVisible, toString, toXMLElement
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangedForceEntity

public RangedForceEntity()

RangedForceEntity

public RangedForceEntity(double x,
                         double y,
                         double width,
                         double height,
                         double attractionStrength)
The ranged force entity is a moving entity with the additional attribute of attraction strength

Parameters:
x - The x coordinate
y - The y coordinate
width - The width of the entity
height - The height of the entity
attractionStrength - The attraction strength of the force

RangedForceEntity

public RangedForceEntity(double x,
                         double y,
                         double width,
                         double height,
                         float orientation,
                         javax.vecmath.Vector2d inputVelocity,
                         int inputMass,
                         double attractionStrength)
The ranged force entity is a moving entity with the additional attribute of attraction strength

Parameters:
x - The x coordinate
y - The y coordinate
width - The width of the entity
height - The height of the entity
orientation - The orientation of the entity
inputVelocity - The initial velocity of the entity
inputMass - The mass of the entity
attractionStrength - The attraction strenght of the entity

RangedForceEntity

public RangedForceEntity(PolygonOrCircle forceShape,
                         double attractionStrength)
Constructs a new ranged force entity

Parameters:
forceShape - The shape of the force
attractionStrength - The attration strength of the force

RangedForceEntity

public RangedForceEntity(PolygonOrCircle forceShape,
                         PolygonOrCircle entityShape,
                         double attractionStrength)
Constructs a new ranged force entity

Parameters:
forceShape - The shape of the force
entityShape - The shape of the entity, ie a planet
attractionStrength - The attration strength of the force
Method Detail

clone

public java.lang.Object clone()
Clones the entity in its current state

Overrides:
clone in class BaseEntity
Returns:
A copy of the entity

DefaultImageLocation

public java.lang.String DefaultImageLocation()
Description copied from class: BaseEntity
Provides the location of the default image

Overrides:
DefaultImageLocation in class MovingEntity
Returns:
Returns the location of the image

Draw

public void Draw(java.awt.Graphics2D g,
                 boolean verbose)
Description copied from class: MovingEntity
Draws the entity

Overrides:
Draw in class MovingEntity
Parameters:
g - The java.awt.Graphics2D object

getAttraction

public double getAttraction()
Gets the attraction force

Returns:
The current attraction force

getForceFor

public javax.vecmath.Vector2d getForceFor(MovingEntity be)
Gets the force vector to act on another entity

Specified by:
getForceFor in interface IForceEntity
Parameters:
be - The entity to get a force for
Returns:
The vector to apply on an entity

IntersectsWith

public boolean IntersectsWith(MovingEntity entity)
Determines if it intersects with another entity

Specified by:
IntersectsWith in interface IForceEntity
Parameters:
entity - Uses the bounding boxes to determine if another entity is intersecting it

isCollidable

public boolean isCollidable()
Description copied from class: BaseEntity
Determines whether or not this entity can be collided with by other entities.

Overrides:
isCollidable in class BaseEntity
Returns:
true if can be collided with

OnLocationChange

protected void OnLocationChange(double deltaX,
                                double deltaY)
Overrides:
OnLocationChange in class BaseEntity

setAttraction

public void setAttraction(double f)
Sets the attraction force

Parameters:
f - The new attraction force