java.lang.Object | +--java.awt.Shape
boolean | contains(double x, double y) Test if the coordinates lie in the shape. |
boolean | contains(java.awt.geom.Point2D p) Test if the point lie in the shape. |
boolean | contains(double x, double y, double w, double h) Test if a high-precision rectangle lies completely in the shape. |
boolean | contains(java.awt.geom.Rectangle2D r) Test if a high-precision rectangle lies completely in the shape. |
java.awt.Rectangle | getBounds() Returns a |
java.awt.geom.Rectangle2D | getBounds2D() Returns a high precision bounding box of the shape. |
java.awt.geom.PathIterator | getPathIterator(java.awt.geom.AffineTransform transform) Return an iterator along the shape boundary. |
java.awt.geom.PathIterator | getPathIterator(java.awt.geom.AffineTransform transform, double flatness) Return an iterator along the flattened version of the shape boundary. |
boolean | intersects(double x, double y, double w, double h) Test if a high-precision rectangle intersects the shape. |
boolean | intersects(java.awt.geom.Rectangle2D r) Test if a high-precision rectangle intersects the shape. |
public boolean contains(double x, double y)
x
- the x coordinatey
- the y coordinatepublic boolean contains(double x, double y, double w, double h)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglew
- the width of the rectangle, undefined results if negativeh
- the height of the rectangle, undefined results if negativepublic boolean contains(java.awt.geom.Point2D p)
p
- the high-precision pointNullPointerException
- if p is nullpublic boolean contains(java.awt.geom.Rectangle2D r)
r
- the rectangleNullPointerException
- if r is nullpublic Rectangle getBounds()
Rectange
that bounds the shape. There is no
guarantee that this is the minimum bounding box, particularly if
the shape overflows the finite integer range of a bound. Generally,
getBounds2D
returns a tighter bound.
public Rectangle2D getBounds2D()
public PathIterator getPathIterator(java.awt.geom.AffineTransform transform)
transform
- an optional transform to apply to the iteratorpublic PathIterator getPathIterator(java.awt.geom.AffineTransform transform, double flatness)
If the optional transform is provided, the iterator is transformed accordingly. Each call returns a new object, independent from others in use. It is recommended, but not required, that the Shape isolate iterations from future changes to the boundary, and document this fact.
transform
- an optional transform to apply to the iteratorflatness
- the maximum distance for deviation from the real boundarypublic boolean intersects(double x, double y, double w, double h)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglew
- the width of the rectangle, undefined results if negativeh
- the height of the rectangle, undefined results if negativepublic boolean intersects(java.awt.geom.Rectangle2D r)
r
- the rectangleNullPointerException
- if r is null
A point is inside if it is completely inside, or on the boundary and adjacent points in the increasing x or y direction are completely inside. Unclosed shapes are considered as implicitly closed when performing
contains
orintersects
.