Class Circle

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Shape>

    public final class Circle
    extends AbstractEllipse
    Defines a circle.

    WARNING: this API is experimental and will likely change in the near future.

    See Also:
    Serialized Form
    • Constructor Detail

      • Circle

        public Circle()
      • Circle

        public Circle​(double centerX,
                      double centerY,
                      double radius)
      • Circle

        public Circle​(Point center,
                      double radius)
    • Method Detail

      • getTypeName

        public java.lang.String getTypeName()
        Specified by:
        getTypeName in class Shape
      • getRadius

        public double getRadius()
        Get the radius for this circle.
      • setRadius

        public void setRadius​(double value)
      • getRadiusA

        protected double getRadiusA()
        Get the first radius for the ellipse.

        This is the radius along the X plane.

        Specified by:
        getRadiusA in class AbstractEllipse
      • getRadiusB

        protected double getRadiusB()
        Get the second for the ellipse.

        This is the radius along the Y plane.

        Specified by:
        getRadiusB in class AbstractEllipse
      • getMaxRadius

        public double getMaxRadius()
        Get the minimum radius for this ellipse.
        Overrides:
        getMaxRadius in class AbstractEllipse
      • getMinRadius

        public double getMinRadius()
        Get the maximum radius for this ellipse.
        Overrides:
        getMinRadius in class AbstractEllipse
      • getPointX

        public double getPointX​(double angle)
        Get the X coordinate for a point on this ellipse at angle.
        Overrides:
        getPointX in class AbstractEllipse
      • getPointY

        public double getPointY​(double angle)
        Get the Y coordinate for a point on this ellipse at angle.
        Overrides:
        getPointY in class AbstractEllipse
      • contains

        public boolean contains​(double x,
                                double y)
        Return true if this shape contains the point defined by (x, y).
        Specified by:
        contains in class Shape
      • distance

        public double distance​(double x,
                               double y)
        Calculate the distance between (x, y) and this circle's center.
      • intersects

        public boolean intersects​(Circle other)
        Check if other and this Circle intersect.
      • intersects

        public boolean intersects​(Rectangle other)
        Check if other and this Circle intersect.
      • fastIntersects

        public boolean fastIntersects​(Rectangle other)
        Check if this shape's bounding box intersects with box.
        Specified by:
        fastIntersects in class Shape
      • getBoundingBox

        public Rectangle getBoundingBox()
        Get the rectangle that represents the bounding box that fully contains this shape.
        Specified by:
        getBoundingBox in class Shape
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Shape
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • addArguments

        public void addArguments​(java.lang.StringBuilder buffer)
        Specified by:
        addArguments in class Shape
      • writeExternal

        public void writeExternal​(java.io.DataOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in class Shape
        Throws:
        java.io.IOException
      • readExternal

        public Circle readExternal​(java.io.DataInput in)
                            throws java.io.IOException
        Specified by:
        readExternal in class Shape
        Throws:
        java.io.IOException