source.ucregents.playground.physics
Class PolygonOrCircle

java.lang.Object
  extended by source.ucregents.playground.physics.PolygonOrCircle
All Implemented Interfaces:
java.lang.Cloneable

public class PolygonOrCircle
extends java.lang.Object
implements java.lang.Cloneable


Constructor Summary
PolygonOrCircle()
           
PolygonOrCircle(double[] xyCoords)
           
PolygonOrCircle(double[] xCoords, double[] yCoords, int nPoints)
           
PolygonOrCircle(double x, double y, double radius)
           
PolygonOrCircle(double x, double y, double width, double height)
           
PolygonOrCircle(java.awt.geom.Point2D upperLeft, double radius)
           
PolygonOrCircle(java.util.Vector<? extends java.awt.geom.Point2D> points)
           
 
Method Summary
 void calculateCentroid()
          Calculates the centroid
 java.lang.Object clone()
           
 double getArea()
          Calculates the area of the polygon
 java.awt.geom.Rectangle2D GetBoundingBox()
           
 double getCenterX()
           
 double getCenterY()
           
 java.awt.geom.Point2D getCentroid()
          Returns the centroid for the polygon
 java.awt.Shape getShape()
           
 double getX()
           
 double getY()
           
 boolean isCircle()
           
 boolean isPolygon()
           
 void Rotate(double degrees)
           
 void RotateRadians(double radians)
           
 java.awt.geom.Point2D.Double Scale(double s)
          A fixed ratio scale of the PolygonOrCircle around the UL Point
 void ScaleAroundCenter(double s)
           
 void Translate(double x, double y)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonOrCircle

public PolygonOrCircle()

PolygonOrCircle

public PolygonOrCircle(double[] xyCoords)

PolygonOrCircle

public PolygonOrCircle(double[] xCoords,
                       double[] yCoords,
                       int nPoints)

PolygonOrCircle

public PolygonOrCircle(double x,
                       double y,
                       double radius)

PolygonOrCircle

public PolygonOrCircle(double x,
                       double y,
                       double width,
                       double height)

PolygonOrCircle

public PolygonOrCircle(java.awt.geom.Point2D upperLeft,
                       double radius)

PolygonOrCircle

public PolygonOrCircle(java.util.Vector<? extends java.awt.geom.Point2D> points)
Method Detail

calculateCentroid

public void calculateCentroid()
Calculates the centroid


clone

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

getArea

public double getArea()
Calculates the area of the polygon

Returns:
The Area of the polygon

GetBoundingBox

public java.awt.geom.Rectangle2D GetBoundingBox()

getCenterX

public double getCenterX()

getCenterY

public double getCenterY()

getCentroid

public java.awt.geom.Point2D getCentroid()
Returns the centroid for the polygon

Returns:
The centroid of the polygon

getShape

public java.awt.Shape getShape()

getX

public double getX()

getY

public double getY()

isCircle

public boolean isCircle()

isPolygon

public boolean isPolygon()

Rotate

public void Rotate(double degrees)

RotateRadians

public void RotateRadians(double radians)

Scale

public java.awt.geom.Point2D.Double Scale(double s)
A fixed ratio scale of the PolygonOrCircle around the UL Point

Parameters:
s - The Scalar to scale it by
Returns:
Returns the new UL Point

ScaleAroundCenter

public void ScaleAroundCenter(double s)

Translate

public void Translate(double x,
                      double y)