Class AbstractEllipse

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Shape>
    Direct Known Subclasses:
    Circle, Ellipse

    public abstract class AbstractEllipse
    extends Shape
    Abstract ellipse definition.

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

    See Also:
    Serialized Form
    • Field Detail

      • centerX

        protected double centerX
      • centerY

        protected double centerY
    • Constructor Detail

      • AbstractEllipse

        protected AbstractEllipse​(double centerX,
                                  double centerY)
    • Method Detail

      • getWidth

        public double getWidth()
        Get the width of this shape's bounding box.
        Specified by:
        getWidth in class Shape
      • getHeight

        public double getHeight()
        Get the height of this shape's bounding box.
        Specified by:
        getHeight in class Shape
      • getCenter

        public final Point getCenter()
        Get the center point for this circle.
      • setCenter

        public final void setCenter​(Point value)
      • getCenterX

        public final double getCenterX()
        Get the X coordinate for the center point.
      • setCenterX

        public final void setCenterX​(double value)
      • getCenterY

        public final double getCenterY()
        Get the Y coordinate for the center point.
      • setCenterY

        public final void setCenterY​(double value)
      • getRotationAngle

        protected double getRotationAngle()
        Get the rotation angle for this ellipse (in radians).
      • getRadiusA

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

        This is the radius along the X plane.

      • getRadiusB

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

        This is the radius along the Y plane.

      • getMaxRadius

        public double getMaxRadius()
        Get the minimum radius for this ellipse.
      • getMinRadius

        public double getMinRadius()
        Get the maximum radius for this ellipse.
      • getRotationSin

        protected double getRotationSin()
        Get the sine of the rotation angle.
      • getRotationCos

        protected double getRotationCos()
        Get the cosine of the rotation angle.
      • getPoint

        public Point getPoint​(double angle)
        Get a point on this ellipse at angle.
      • getPointX

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

        public double getPointY​(double angle)
        Get the Y coordinate for a point on this ellipse at angle.
      • intersects

        public boolean intersects​(Rectangle box,
                                  Shape other)
        Check if this shape intersects with other.
        Specified by:
        intersects in class Shape
        Parameters:
        box - The bounding box of this shape from Shape.getBoundingBox().
        other - The shape to check for intersection with
      • intersects

        public abstract boolean intersects​(Rectangle box,
                                           AbstractEllipse other)
        Check for intersection with other.
      • intersects

        public boolean intersects​(Rectangle box,
                                  AbstractPolygon poly)
        Check if this ellipse intersects with poly.
      • getA

        protected static double getA​(double sin,
                                     double cos,
                                     double radiusA2,
                                     double radiusB2)
        Compute the A constant for an ellipse.
      • getB

        protected static double getB​(double sin,
                                     double cos,
                                     double radiusA2,
                                     double radiusB2)
        Compute the B constant for an ellipse.
      • getC

        protected static double getC​(double sin,
                                     double cos,
                                     double radiusA2,
                                     double radiusB2)
        Compute the C constant for an ellipse.