java.awt.geom

Class Ellipse2D

public abstract class Ellipse2D extends RectangularShape

Ellipse2D is the shape of an ellipse.
A drawing of an ellipse
The ellipse is defined by it's bounding box (shown in red), and is defined by the implicit curve:
(x/a)2 + (y/b)2 = 1

Since: 1.2

Nested Class Summary
static classEllipse2D.Double
An {@link Ellipse2D} that stores its coordinates using double primitives.
static classEllipse2D.Float
An {@link Ellipse2D} that stores its coordinates using float primitives.
Constructor Summary
protected Ellipse2D()
Ellipse2D is defined as abstract.
Method Summary
booleancontains(double x, double y)
Determines if a point is contained within the ellipse.
booleancontains(double x, double y, double w, double h)
Determines if a rectangle is completely contained within the ellipse.
PathIteratorgetPathIterator(AffineTransform at)
Returns a PathIterator object corresponding to the ellipse.

Note: An ellipse cannot be represented exactly in PathIterator segments, the outline is thefore approximated with cubic Bezier segments.

booleanintersects(double x, double y, double w, double h)
Determines if a rectangle intersects any part of the ellipse.

Constructor Detail

Ellipse2D

protected Ellipse2D()
Ellipse2D is defined as abstract. Implementing classes are Ellipse2D.Float and Ellipse2D.Double.

Method Detail

contains

public boolean contains(double x, double y)
Determines if a point is contained within the ellipse.

Parameters: x - x coordinate of the point. y - y coordinate of the point.

Returns: true if the point is within the ellipse, false otherwise.

contains

public boolean contains(double x, double y, double w, double h)
Determines if a rectangle is completely contained within the ellipse.

Parameters: x - x coordinate of the upper-left corner of the rectangle y - y coordinate of the upper-left corner of the rectangle w - width of the rectangle h - height of the rectangle

Returns: true if the rectangle is completely contained, false otherwise.

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Returns a PathIterator object corresponding to the ellipse.

Note: An ellipse cannot be represented exactly in PathIterator segments, the outline is thefore approximated with cubic Bezier segments.

Parameters: at an optional transform.

Returns: A path iterator.

intersects

public boolean intersects(double x, double y, double w, double h)
Determines if a rectangle intersects any part of the ellipse.

Parameters: x - x coordinate of the upper-left corner of the rectangle y - y coordinate of the upper-left corner of the rectangle w - width of the rectangle h - height of the rectangle

Returns: true if the rectangle intersects the ellipse, false otherwise.