Documentation of 'edu.rit.draw.item.Ellipse' Java class
Ellipse
edu.rit.draw.item

Class Ellipse

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable


    public class Ellipse
    extends RectangularItem
    Class Ellipse provides an ellipse DrawingItem. A circle is a special case of an ellipse with equal width and height.

    The static defaultSize(), defaultWidth(), and defaultHeight() methods are provided to set the default size, width, and height. If an ellipse's size, width, or height is not specified, the current default size, width, or height is used.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      Ellipse()
      Construct a new ellipse.
      Ellipse(Ellipse theItem)
      Construct a new ellipse with the same outline, fill paint, location, and size as the given ellipse.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Ellipse add()
      Add this ellipse to the end of the default drawing's sequence of drawing items.
      Ellipse add(Drawing theDrawing)
      Add this ellipse to the end of the given drawing's sequence of drawing items.
      Ellipse addFirst()
      Add this ellipse to the beginning of the default drawing's sequence of drawing items.
      Ellipse addFirst(Drawing theDrawing)
      Add this ellipse to the beginning of the given drawing's sequence of drawing items.
      Ellipse c(double x, double y)
      Set the center point of this ellipse's bounding box.
      Ellipse c(Point thePoint)
      Set the center point of this ellipse's bounding box.
      Point circumferencePoint(double angle)
      Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center.
      Point circumferencePoint(double angle, double length)
      Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center, extended outward by the given length.
      Point circumferencePointDegrees(double angle)
      Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center.
      Point circumferencePointDegrees(double angle, double length)
      Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center, extended outward by the given length.
      static double defaultHeight()
      Returns the default height for ellipses.
      static void defaultHeight(double theHeight)
      Set the default height for ellipses.
      static Size defaultSize()
      Returns the default size for ellipses.
      static void defaultSize(Size theSize)
      Set the default size for ellipses.
      static double defaultWidth()
      Returns the default width for ellipses.
      static void defaultWidth(double theWidth)
      Set the default width for ellipses.
      Ellipse diameter(double theDiameter)
      Set the width and height of this ellipse's bounding box to make this ellipse a circle.
      Ellipse e(double x, double y)
      Set the east middle point of this ellipse's bounding box.
      Ellipse e(Point thePoint)
      Set the east middle point of this ellipse's bounding box.
      Ellipse fill(Fill theFill)
      Set this ellipse's fill paint.
      Ellipse height(double theHeight)
      Set the height of this ellipse's bounding box.
      Ellipse n(double x, double y)
      Set the north middle point of this ellipse's bounding box.
      Ellipse n(Point thePoint)
      Set the north middle point of this ellipse's bounding box.
      Ellipse ne(double x, double y)
      Set the northeast corner point of this ellipse's bounding box.
      Ellipse ne(Point thePoint)
      Set the northeast corner point of this ellipse's bounding box.
      Ellipse nw(double x, double y)
      Set the northwest corner point of this ellipse's bounding box.
      Ellipse nw(Point thePoint)
      Set the northwest corner point of this ellipse's bounding box.
      Ellipse outline(Outline theOutline)
      Set this ellipse's outline.
      Point perimeterIntersection(double x, double y)
      Returns the point of intersection between (1) this ellipse's perimeter and (2) the line passing through this ellipse's center and the given point.
      Point perimeterIntersection(Point point)
      Returns the point of intersection between (1) this ellipse's perimeter and (2) the line passing through this ellipse's center and the given point.
      Ellipse s(double x, double y)
      Set the south middle point of this ellipse's bounding box.
      Ellipse s(Point thePoint)
      Set the south middle point of this ellipse's bounding box.
      Ellipse se(double x, double y)
      Set the southeast corner point of this ellipse's bounding box.
      Ellipse se(Point thePoint)
      Set the southeast corner point of this ellipse's bounding box.
      Ellipse size(Size theSize)
      Set the size of this ellipse's bounding box.
      Ellipse sw(double x, double y)
      Set the southwest corner point of this ellipse's bounding box.
      Ellipse sw(Point thePoint)
      Set the southwest corner point of this ellipse's bounding box.
      Ellipse w(double x, double y)
      Set the west middle point of this ellipse's bounding box.
      Ellipse w(Point thePoint)
      Set the west middle point of this ellipse's bounding box.
      Ellipse width(double theWidth)
      Set the width of this ellipse's bounding box.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NORMAL_WIDTH

        public static final double NORMAL_WIDTH
        The normal width for ellipses (72). Note: 72 points = 1 inch.
        See Also:
        Constant Field Values
      • NORMAL_HEIGHT

        public static final double NORMAL_HEIGHT
        The normal height for ellipses (72). Note: 72 points = 1 inch.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Ellipse

        public Ellipse()
        Construct a new ellipse. The ellipse's northwest corner is located at (0,0). The ellipse's size is the default size.
      • Ellipse

        public Ellipse(Ellipse theItem)
        Construct a new ellipse with the same outline, fill paint, location, and size as the given ellipse.
        Parameters:
        theItem - Ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theItem is null.
    • Method Detail

      • defaultSize

        public static Size defaultSize()
        Returns the default size for ellipses.
        Returns:
        Default size.
      • defaultSize

        public static void defaultSize(Size theSize)
        Set the default size for ellipses.
        Parameters:
        theSize - Default size.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if the width or the height of theSize is less than 0.
      • defaultWidth

        public static double defaultWidth()
        Returns the default width for ellipses.
        Returns:
        Default width.
      • defaultWidth

        public static void defaultWidth(double theWidth)
        Set the default width for ellipses.
        Parameters:
        theWidth - Default width.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if theWidth is less than 0.
      • defaultHeight

        public static double defaultHeight()
        Returns the default height for ellipses.
        Returns:
        Default height.
      • defaultHeight

        public static void defaultHeight(double theHeight)
        Set the default height for ellipses.
        Parameters:
        theHeight - Default height.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if theHeight is less than 0.
      • outline

        public Ellipse outline(Outline theOutline)
        Set this ellipse's outline.
        Overrides:
        outline in class RectangularItem
        Parameters:
        theOutline - Outline, or Outline.NONE.
        Returns:
        This ellipse.
      • fill

        public Ellipse fill(Fill theFill)
        Set this ellipse's fill paint.
        Overrides:
        fill in class RectangularItem
        Parameters:
        theFill - Fill paint, or Fill.NONE.
        Returns:
        This ellipse.
      • size

        public Ellipse size(Size theSize)
        Set the size of this ellipse's bounding box.
        Overrides:
        size in class RectangularItem
        Parameters:
        theSize - Size.
        Returns:
        This ellipse.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if the width or the height of theSize is less than 0.
      • width

        public Ellipse width(double theWidth)
        Set the width of this ellipse's bounding box.
        Overrides:
        width in class RectangularItem
        Parameters:
        theWidth - Width.
        Returns:
        This ellipse.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if theWidth is less than 0.
      • height

        public Ellipse height(double theHeight)
        Set the height of this ellipse's bounding box.
        Overrides:
        height in class RectangularItem
        Parameters:
        theHeight - Height.
        Returns:
        This ellipse.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if theHeight is less than 0.
      • diameter

        public Ellipse diameter(double theDiameter)
        Set the width and height of this ellipse's bounding box to make this ellipse a circle.
        Parameters:
        theDiameter - Diameter.
        Returns:
        This ellipse.
        Throws:
        java.lang.IllegalArgumentException - (unchecked exception) Thrown if theDiameter is less than 0.
      • nw

        public Ellipse nw(double x,
                          double y)
        Set the northwest corner point of this ellipse's bounding box.
        Overrides:
        nw in class RectangularItem
        Parameters:
        x - X coordinate of northwest corner point.
        y - Y coordinate of northwest corner point.
        Returns:
        This ellipse.
      • nw

        public Ellipse nw(Point thePoint)
        Set the northwest corner point of this ellipse's bounding box.
        Overrides:
        nw in class RectangularItem
        Parameters:
        thePoint - Northwest corner point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • n

        public Ellipse n(double x,
                         double y)
        Set the north middle point of this ellipse's bounding box.
        Overrides:
        n in class RectangularItem
        Parameters:
        x - X coordinate of north middle point.
        y - Y coordinate of north middle point.
        Returns:
        This ellipse.
      • n

        public Ellipse n(Point thePoint)
        Set the north middle point of this ellipse's bounding box.
        Overrides:
        n in class RectangularItem
        Parameters:
        thePoint - North middle point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • ne

        public Ellipse ne(double x,
                          double y)
        Set the northeast corner point of this ellipse's bounding box.
        Overrides:
        ne in class RectangularItem
        Parameters:
        x - X coordinate of northeast corner point.
        y - Y coordinate of northeast corner point.
        Returns:
        This ellipse.
      • ne

        public Ellipse ne(Point thePoint)
        Set the northeast corner point of this ellipse's bounding box.
        Overrides:
        ne in class RectangularItem
        Parameters:
        thePoint - Northeast corner point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • w

        public Ellipse w(double x,
                         double y)
        Set the west middle point of this ellipse's bounding box.
        Overrides:
        w in class RectangularItem
        Parameters:
        x - X coordinate of west middle point.
        y - Y coordinate of west middle point.
        Returns:
        This ellipse.
      • w

        public Ellipse w(Point thePoint)
        Set the west middle point of this ellipse's bounding box.
        Overrides:
        w in class RectangularItem
        Parameters:
        thePoint - West middle point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • c

        public Ellipse c(double x,
                         double y)
        Set the center point of this ellipse's bounding box.
        Overrides:
        c in class RectangularItem
        Parameters:
        x - X coordinate of center point.
        y - Y coordinate of center point.
        Returns:
        This ellipse.
      • c

        public Ellipse c(Point thePoint)
        Set the center point of this ellipse's bounding box.
        Overrides:
        c in class RectangularItem
        Parameters:
        thePoint - Center point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • e

        public Ellipse e(double x,
                         double y)
        Set the east middle point of this ellipse's bounding box.
        Overrides:
        e in class RectangularItem
        Parameters:
        x - X coordinate of east middle point.
        y - Y coordinate of east middle point.
        Returns:
        This ellipse.
      • e

        public Ellipse e(Point thePoint)
        Set the east middle point of this ellipse's bounding box.
        Overrides:
        e in class RectangularItem
        Parameters:
        thePoint - East middle point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • sw

        public Ellipse sw(double x,
                          double y)
        Set the southwest corner point of this ellipse's bounding box.
        Overrides:
        sw in class RectangularItem
        Parameters:
        x - X coordinate of southwest corner point.
        y - Y coordinate of southwest corner point.
        Returns:
        This ellipse.
      • sw

        public Ellipse sw(Point thePoint)
        Set the southwest corner point of this ellipse's bounding box.
        Overrides:
        sw in class RectangularItem
        Parameters:
        thePoint - Southwest corner point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • s

        public Ellipse s(double x,
                         double y)
        Set the south middle point of this ellipse's bounding box.
        Overrides:
        s in class RectangularItem
        Parameters:
        x - X coordinate of south middle point.
        y - Y coordinate of south middle point.
        Returns:
        This ellipse.
      • s

        public Ellipse s(Point thePoint)
        Set the south middle point of this ellipse's bounding box.
        Overrides:
        s in class RectangularItem
        Parameters:
        thePoint - South middle point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • se

        public Ellipse se(double x,
                          double y)
        Set the southeast corner point of this ellipse's bounding box.
        Overrides:
        se in class RectangularItem
        Parameters:
        x - X coordinate of southeast corner point.
        y - Y coordinate of southeast corner point.
        Returns:
        This ellipse.
      • se

        public Ellipse se(Point thePoint)
        Set the southeast corner point of this ellipse's bounding box.
        Overrides:
        se in class RectangularItem
        Parameters:
        thePoint - Southeast corner point.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if thePoint is null.
      • add

        public Ellipse add()
        Add this ellipse to the end of the default drawing's sequence of drawing items.
        Overrides:
        add in class RectangularItem
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if there is no default drawing.
        See Also:
        Drawing.defaultDrawing()
      • add

        public Ellipse add(Drawing theDrawing)
        Add this ellipse to the end of the given drawing's sequence of drawing items.
        Overrides:
        add in class RectangularItem
        Parameters:
        theDrawing - Drawing.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theDrawing is null.
      • addFirst

        public Ellipse addFirst()
        Add this ellipse to the beginning of the default drawing's sequence of drawing items.
        Overrides:
        addFirst in class RectangularItem
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if there is no default drawing.
        See Also:
        Drawing.defaultDrawing()
      • addFirst

        public Ellipse addFirst(Drawing theDrawing)
        Add this ellipse to the beginning of the given drawing's sequence of drawing items.
        Overrides:
        addFirst in class RectangularItem
        Parameters:
        theDrawing - Drawing.
        Returns:
        This ellipse.
        Throws:
        java.lang.NullPointerException - (unchecked exception) Thrown if theDrawing is null.
      • circumferencePoint

        public Point circumferencePoint(double angle)
        Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center. The point on the ellipse's circumference is determined by angle, measured in radians. An angle of 0 gives the east point; an angle of pi/2 gives the south point; an angle of pi gives the west point; an angle of 3*pi/2 gives the north point.
        Parameters:
        angle - Angle (radians).
        Returns:
        Point on this ellipse's circumference.
      • circumferencePointDegrees

        public Point circumferencePointDegrees(double angle)
        Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center. The point on the ellipse's circumference is determined by angle, measured in degrees. An angle of 0 gives the east point; an angle of 90 gives the south point; an angle of 180 gives the west point; an angle of 270 gives the north point.
        Parameters:
        angle - Angle (degrees).
        Returns:
        Point on this ellipse's circumference.
      • circumferencePoint

        public Point circumferencePoint(double angle,
                                        double length)
        Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center, extended outward by the given length. First, a point on this ellipse's circumference is determined by angle, measured in radians. An angle of 0 gives the east point; an angle of pi/2 gives the south point; an angle of pi gives the west point; an angle of 3*pi/2 gives the north point. A line is projected from the center of this ellipse, through the point on the circumference, for a further distance of length; the endpoint of this line is returned.
        Parameters:
        angle - Angle (radians).
        length - Length to extend from circumference.
        Returns:
        Point extended outward from this ellipse's circumference.
      • circumferencePointDegrees

        public Point circumferencePointDegrees(double angle,
                                               double length)
        Returns the point on the circumference of this ellipse at the given angle relative to this ellipse's center, extended outward by the given length. First, a point on this ellipse's circumference is determined by angle, measured in degrees. An angle of 0 gives the east point; an angle of 90 gives the south point; an angle of 180 gives the west point; an angle of 270 gives the north point. A line is projected from the center of this ellipse, through the point on the circumference, for a further distance of length; the endpoint of this line is returned.
        Parameters:
        angle - Angle (degrees).
        length - Length to extend from circumference.
        Returns:
        Point extended outward from this ellipse's circumference.
      • perimeterIntersection

        public Point perimeterIntersection(Point point)
        Returns the point of intersection between (1) this ellipse's perimeter and (2) the line passing through this ellipse's center and the given point.
        Parameters:
        point - One point on the line.
        Returns:
        Point of intersection between perimeter and line.
      • perimeterIntersection

        public Point perimeterIntersection(double x,
                                           double y)
        Returns the point of intersection between (1) this ellipse's perimeter and (2) the line passing through this ellipse's center and the given point.
        Parameters:
        x - X coordinate of one point on the line.
        y - Y coordinate of one point on the line.
        Returns:
        Point of intersection between perimeter and line.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.