public class Ellipse2D extends RectangularShape
Ellipse2D
class describes an ellipse that is defined
by a framing rectangle.Modifier and Type | Field and Description |
---|---|
float |
height
The overall height of this
Ellipse2D . |
float |
width
The overall width of this
Ellipse2D . |
float |
x
The X coordinate of the upper-left corner of the
framing rectangle of this
Ellipse2D . |
float |
y
The Y coordinate of the upper-left corner of the
framing rectangle of this
Ellipse2D . |
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP, RECT_INTERSECTS
Constructor and Description |
---|
Ellipse2D()
Constructs a new
Ellipse2D , initialized to
location (0, 0) and size (0, 0). |
Ellipse2D(float x,
float y,
float w,
float h)
Constructs and initializes an
Ellipse2D from the
specified coordinates. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(float x,
float y)
Tests if the specified coordinates are inside the boundary of the
Shape . |
boolean |
contains(float x,
float y,
float w,
float h)
Tests if the interior of the
Shape entirely contains
the specified rectangular area. |
Ellipse2D |
copy()
Returns a new copy of this
Shape instance. |
boolean |
equals(Object obj)
Determines whether or not the specified
Object is
equal to this Ellipse2D . |
RectBounds |
getBounds()
Note that there is no guarantee that the returned
RectBounds is the smallest bounding box that encloses
the Shape , only that the Shape lies
entirely within the indicated RectBounds . |
float |
getHeight()
Returns the height of the framing rectangle
in
double precision. |
PathIterator |
getPathIterator(BaseTransform tx)
Returns an iteration object that defines the boundary of this
Ellipse2D . |
float |
getWidth()
Returns the width of the framing rectangle in
double precision. |
float |
getX()
Returns the X coordinate of the upper-left corner of
the framing rectangle in
double precision. |
float |
getY()
Returns the Y coordinate of the upper-left corner of
the framing rectangle in
double precision. |
int |
hashCode()
Returns the hashcode for this
Ellipse2D . |
boolean |
intersects(float x,
float y,
float w,
float h)
Tests if the interior of the
Shape intersects the
interior of a specified rectangular area. |
boolean |
isEmpty()
Determines whether the
RectangularShape is empty. |
void |
setFrame(float x,
float y,
float w,
float h)
Sets the location and size of the framing rectangle of this
Shape to the specified rectangular values. |
contains, getCenterX, getCenterY, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal, toString
accumulate, accumulateCubic, accumulateCubic, accumulateQuad, contains, intersects, pointCrossingsForCubic, pointCrossingsForLine, pointCrossingsForPath, pointCrossingsForQuad, rectCrossingsForCubic, rectCrossingsForLine, rectCrossingsForPath, rectCrossingsForQuad
public float x
Ellipse2D
.public float y
Ellipse2D
.public float width
Ellipse2D
.public float height
Ellipse2D
.public Ellipse2D()
Ellipse2D
, initialized to
location (0, 0) and size (0, 0).public Ellipse2D(float x, float y, float w, float h)
Ellipse2D
from the
specified coordinates.x
- the X coordinate of the upper-left corner
of the framing rectangley
- the Y coordinate of the upper-left corner
of the framing rectanglew
- the width of the framing rectangleh
- the height of the framing rectanglepublic float getX()
double
precision.getX
in class RectangularShape
public float getY()
double
precision.getY
in class RectangularShape
public float getWidth()
double
precision.getWidth
in class RectangularShape
public float getHeight()
double
precision.getHeight
in class RectangularShape
public boolean isEmpty()
RectangularShape
is empty.
When the RectangularShape
is empty, it encloses no
area.isEmpty
in class RectangularShape
true
if the RectangularShape
is empty;
false
otherwise.public void setFrame(float x, float y, float w, float h)
Shape
to the specified rectangular values.setFrame
in class RectangularShape
x
- the X coordinate of the upper-left corner of the
specified rectangular shapey
- the Y coordinate of the upper-left corner of the
specified rectangular shapew
- the width of the specified rectangular shapeh
- the height of the specified rectangular shape#getFrame
public RectBounds getBounds()
RectBounds
is the smallest bounding box that encloses
the Shape
, only that the Shape
lies
entirely within the indicated RectBounds
.getBounds
in class RectangularShape
RectBounds
public boolean contains(float x, float y)
Shape
.public boolean intersects(float x, float y, float w, float h)
Shape
intersects the
interior of a specified rectangular area.
The rectangular area is considered to intersect the Shape
if any point is contained in both the interior of the
Shape
and the specified rectangular area.
The Shape.intersects()
method allows a Shape
implementation to conservatively return true
when:
Shape
intersect, but
Shapes
this method might
return true
even though the rectangular area does not
intersect the Shape
.
The Area
class performs
more accurate computations of geometric intersection than most
Shape
objects and therefore can be used if a more precise
answer is required.intersects
in class Shape
x
- the X coordinate of the upper-left corner
of the specified rectangular areay
- the Y coordinate of the upper-left corner
of the specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areatrue
if the interior of the Shape
and
the interior of the rectangular area intersect, or are
both highly likely to intersect and intersection calculations
would be too expensive to perform; false
otherwise.public boolean contains(float x, float y, float w, float h)
Shape
entirely contains
the specified rectangular area. All coordinates that lie inside
the rectangular area must lie within the Shape
for the
entire rectanglar area to be considered contained within the
Shape
.
The Shape.contains()
method allows a Shape
implementation to conservatively return false
when:
intersect
method returns true
and
Shape
entirely contains the rectangular area are
prohibitively expensive.
Shapes
this method might
return false
even though the Shape
contains
the rectangular area.
The Area
class performs
more accurate geometric computations than most
Shape
objects and therefore can be used if a more precise
answer is required.contains
in class Shape
x
- the X coordinate of the upper-left corner
of the specified rectangular areay
- the Y coordinate of the upper-left corner
of the specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areatrue
if the interior of the Shape
entirely contains the specified rectangular area;
false
otherwise or, if the Shape
contains the rectangular area and the
intersects
method returns true
and the containment calculations would be too expensive to
perform.Shape.intersects(float, float, float, float)
public PathIterator getPathIterator(BaseTransform tx)
Ellipse2D
.
The iterator for this class is multi-threaded safe, which means
that this Ellipse2D
class guarantees that
modifications to the geometry of this Ellipse2D
object do not affect any iterations of that geometry that
are already in process.getPathIterator
in class Shape
tx
- an optional BaseTransform
to be applied to
the coordinates as they are returned in the iteration, or
null
if untransformed coordinates are desiredPathIterator
object that returns the
geometry of the outline of this Ellipse2D
,
one segment at a time.public Ellipse2D copy()
Shape
Shape
instance.public int hashCode()
Ellipse2D
.public boolean equals(Object obj)
Object
is
equal to this Ellipse2D
. The specified
Object
is equal to this Ellipse2D
if it is an instance of Ellipse2D
and if its
location and size are the same as this Ellipse2D
.Copyright © 2020. All rights reserved.