cmsc420.geom
Class Circle2D.Float

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Ellipse2D
          extended by cmsc420.geom.Circle2D
              extended by cmsc420.geom.Circle2D.Float
All Implemented Interfaces:
Geometry2D, java.awt.Shape, java.lang.Cloneable
Enclosing class:
Circle2D

public static class Circle2D.Float
extends Circle2D

The Float class defines an ellipse specified in float precision.

Version:
1.0, 12 Feb 2007
Author:
Ben Zoller

Nested Class Summary
 
Nested classes/interfaces inherited from class cmsc420.geom.Circle2D
Circle2D.Double, Circle2D.Float
 
Field Summary
 
Fields inherited from interface cmsc420.geom.Geometry2D
CIRCLE, POINT, RECTANGLE, SEGMENT
 
Constructor Summary
Circle2D.Float(float centerX, float centerY, float radius)
          Constructs and initializes a Circle2D with the specified coordinates.
Circle2D.Float(java.awt.geom.Point2D.Float center, float radius)
          Constructs and initializes a Circle2D with the specified coordinates.
 
Method Summary
 java.awt.geom.Rectangle2D getBounds2D()
          Returns the high precision bounding box of this Ellipse2D.
 double getCenterX()
          Gets the X coordinate of the center of this circle.
 double getCenterY()
          Gets the Y coordinate of the center of this circle.
 double getHeight()
          Gets the height of this circle.
 double getRadius()
          Gets the radius of this circle.
 double getWidth()
          Gets the width of this circle.
 double getX()
          Gets the X coordinate of the origin of this circle.
 double getY()
          Gets the Y coordinate of the origin of this circle.
 boolean isEmpty()
          Determines whether or not the bounding box of this Ellipse2D is empty.
 void setCenter(java.awt.geom.Point2D point)
          Sets the center point of this circle.
 void setFrame(double x, double y, double w, double h)
          Sets the location and size of this Ellipse2D to the specified double values.
 void setRadius(double radius)
          Sets the radius of this circle.
 
Methods inherited from class cmsc420.geom.Circle2D
getCenter, getType
 
Methods inherited from class java.awt.geom.Ellipse2D
contains, contains, equals, getPathIterator, hashCode, intersects
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Circle2D.Float

public Circle2D.Float(float centerX,
                      float centerY,
                      float radius)
Constructs and initializes a Circle2D with the specified coordinates.

Parameters:
centerX - X coordinate of the center of this circle
centerY - Y coordinate of the center of this circle
radius - radius of this circle

Circle2D.Float

public Circle2D.Float(java.awt.geom.Point2D.Float center,
                      float radius)
Constructs and initializes a Circle2D with the specified coordinates.

Parameters:
center - center point of this circle
radius - radius of this circle
Method Detail

getRadius

public double getRadius()
Gets the radius of this circle.

Specified by:
getRadius in class Circle2D
Returns:
radius of this circle

getCenterX

public double getCenterX()
Gets the X coordinate of the center of this circle.

Overrides:
getCenterX in class java.awt.geom.RectangularShape
Returns:
the X coordinate of the center of this circle

getCenterY

public double getCenterY()
Gets the Y coordinate of the center of this circle.

Overrides:
getCenterY in class java.awt.geom.RectangularShape
Returns:
the Y coordinate of the center of this circle

getHeight

public double getHeight()
Gets the height of this circle.

Specified by:
getHeight in class java.awt.geom.RectangularShape
Returns:
height of this circle

getWidth

public double getWidth()
Gets the width of this circle.

Specified by:
getWidth in class java.awt.geom.RectangularShape
Returns:
width of this circle

getX

public double getX()
Gets the X coordinate of the origin of this circle.

Specified by:
getX in class java.awt.geom.RectangularShape
Returns:
the X coordinate of the origin of this circle

getY

public double getY()
Gets the Y coordinate of the origin of this circle.

Specified by:
getY in class java.awt.geom.RectangularShape
Returns:
the Y coordinate of the origin of this circle

setCenter

public void setCenter(java.awt.geom.Point2D point)
Sets the center point of this circle.

Specified by:
setCenter in class Circle2D
Parameters:
point - center point of this circle

setRadius

public void setRadius(double radius)
Sets the radius of this circle.

Specified by:
setRadius in class Circle2D
Parameters:
radius - radius of this circle

isEmpty

public boolean isEmpty()
Determines whether or not the bounding box of this Ellipse2D is empty.

Specified by:
isEmpty in class java.awt.geom.RectangularShape
Returns:
true if the bounding rectangle of this Ellipse2D is empty; false otherwise.

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
Sets the location and size of this Ellipse2D to the specified double values.

Specified by:
setFrame in class java.awt.geom.RectangularShape
Parameters:
x - the specified X coordinate to which to set the location of the bounding box of this Ellipse2D
y - the specified Y coordinate to which to set the location of the bounding box of this Ellipse2D
w - the specified width to which to set the width of this Ellipse2D
h - the specified height to which to set the height of this Ellipse2D
Throws:
java.lang.IllegalArgumentException - if the width is not equal to the height

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Returns the high precision bounding box of this Ellipse2D.

Returns:
a Rectangle2D that is the bounding box of this Ellipse2D.