source.ucregents.playground.physics
Class BaseFieldForceEntity

java.lang.Object
  extended by source.ucregents.playground.physics.BaseEntity
      extended by source.ucregents.playground.physics.BaseFieldForceEntity
All Implemented Interfaces:
java.lang.Cloneable, IForceEntity
Direct Known Subclasses:
FieldForceEntity, ScaledMassFieldForce

public abstract class BaseFieldForceEntity
extends BaseEntity
implements IForceEntity

The ForceEntity class creates an entity which produces a "force" which can attract or repel "MovingEntities" and can act uniformly on the playing field or drop off over a distance. The ForceEntity does not move itself.


Constructor Summary
BaseFieldForceEntity()
          Constructs a default field force entity at 0,0 with 1 width and 1 height and 0 magnitude
BaseFieldForceEntity(int x_loc, int y_loc, int width, int height)
          Constructs a custom field force entity with the given parameters
BaseFieldForceEntity(PolygonOrCircle forceShape, boolean isVisible)
          Constructs a custom field force entity with the given parameters
 
Method Summary
 java.lang.Object clone()
           
protected  java.lang.String DefaultImageLocation()
          Provides the location of the default image
 void Draw(java.awt.Graphics2D g, boolean verbose)
          Draws the field force
 java.awt.geom.Rectangle2D getResizingObject()
          Gets the area to show resizing arrows
 boolean IntersectsWith(MovingEntity entity)
          Returns if any entity is in contact with the field
 boolean isCollidable()
          Determines whether or not this entity can be collided with by other entities.
protected  void OnCenterScale(double s)
           
protected  void OnLocationChange(double deltaX, double deltaY)
           
protected  void OnULScale(double s)
           
 
Methods inherited from class source.ucregents.playground.physics.BaseEntity
calculateAxes, Deserialize, getActualFrameDimensions, getAxes, getAxesClone, getAxis, getBounciness, getCenterPoint, getDrawType, getEvents, getFrameColor, getFrictionConstant, getGradientColor, getImageOffset, getName, getOrientation, getRoundedShapeMass, getScale, getShape, getShapeColor, getShapeFrame, getShapeMass, getSideVectors, getULPoint, getUserEvents, getVertexCount, getVerticesCoordinates, isCircle, isOverlapping, isPolygon, isSelected, isVisible, OnCollisionWith, OnOrientationChange, RegisterEvent, RegisterEvent, RegisterEvents, RemoveEvent, RemoveEvents, resetFrameColor, Scale, ScaleAroundCenter, Serialize, 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
 
Methods inherited from interface source.ucregents.playground.physics.IForceEntity
getForceFor
 

Constructor Detail

BaseFieldForceEntity

public BaseFieldForceEntity()
Constructs a default field force entity at 0,0 with 1 width and 1 height and 0 magnitude


BaseFieldForceEntity

public BaseFieldForceEntity(int x_loc,
                            int y_loc,
                            int width,
                            int height)
Constructs a custom field force entity with the given parameters

Parameters:
x_loc - X location
y_loc - Y location
width - Field width
height - Field height

BaseFieldForceEntity

public BaseFieldForceEntity(PolygonOrCircle forceShape,
                            boolean isVisible)
Constructs a custom field force entity with the given parameters

Parameters:
forceShape - Bounding field rectangle
isVisible - Field Visibility
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class BaseEntity

DefaultImageLocation

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

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

Draw

public void Draw(java.awt.Graphics2D g,
                 boolean verbose)
Draws the field force

Overrides:
Draw in class BaseEntity
Parameters:
g - The graphics2d to be drawn

getResizingObject

public java.awt.geom.Rectangle2D getResizingObject()
Description copied from class: BaseEntity
Gets the area to show resizing arrows

Overrides:
getResizingObject in class BaseEntity
Returns:
Gets the risizing box

IntersectsWith

public boolean IntersectsWith(MovingEntity entity)
Returns if any entity is in contact with the field

Specified by:
IntersectsWith in interface IForceEntity
Parameters:
entity - The entity to check intersection with
Returns:
Returns true if an entity is approx. in contact with the field

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

OnCenterScale

protected void OnCenterScale(double s)
Overrides:
OnCenterScale in class BaseEntity

OnLocationChange

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

OnULScale

protected void OnULScale(double s)
Overrides:
OnULScale in class BaseEntity