The
Shape interface provides definitions for objects that represent some form of geometric shape. The
Shape is described by a {@link PathIterator} object, which can express the outline of the
Shape as well as a rule for determining how the outline divides the 2D plane into interior and exterior points. Each
Shape object provides callbacks to get the bounding box of the geometry, determine whether points or rectangles lie partly or entirely within the interior of the
Shape, and retrieve a
PathIterator object that describes the trajectory path of the
Shape outline.
Definition of insideness: A point is considered to lie inside a Shape if and only if:
- it lies completely inside the
Shape boundary or - it lies exactly on the
Shape boundary and the space immediately adjacent to the point in the increasing X direction is entirely inside the boundary or - it lies exactly on a horizontal boundary segment and the space immediately adjacent to the point in the increasing
Y direction is inside the boundary.
The contains and intersects methods consider the interior of a Shape to be the area it encloses as if it were filled. This means that these methods consider unclosed shapes to be implicitly closed for the purpose of determining if a shape contains or intersects a rectangle or if a shape contains a point.
@see java.awt.geom.PathIterator
@see java.awt.geom.AffineTransform
@see java.awt.geom.FlatteningPathIterator
@see java.awt.geom.GeneralPath
@version 1.19 06/24/98
@author Jim Graham
@since 1.2