public abstract class IlvPolygon2D extends Object implements Shape, Cloneable
IlvPolygon2D
instance describes a closed (circular)
polyline with no specific starting or end points, in other words,
a polygon. The coordinates of the points can be of type float
or double
. The polygon uses the even-odd winding rule to test
for containment (see
WIND_EVEN_ODD
).Modifier and Type | Class and Description |
---|---|
static class |
IlvPolygon2D.Double
The
Double class defines a polygon with
double coordinates. |
static class |
IlvPolygon2D.Float
The
Float class defines a polygon with
float coordinates. |
Modifier | Constructor and Description |
---|---|
protected |
IlvPolygon2D()
This class is abstract.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Determines whether a point is contained in this
Shape . |
boolean |
contains(double x,
double y,
double width,
double height)
Determines whether a rectangle is contained in this
Shape . |
boolean |
contains(Point2D p)
Determines whether a point is contained in this
Shape . |
boolean |
contains(Rectangle2D r)
Determines whether a rectangle is contained in this
Shape . |
boolean |
containsInClosure(double x,
double y)
Determines whether a point is contained in this polygon (inside or
on the border).
|
boolean |
containsInConvexHull(Point2D point)
Determines whether a point is contained in the convex hull of this
polygon.
|
boolean |
containsInInterior(double x,
double y)
Determines whether a point is contained in the inside area of this
polygon.
|
boolean |
equals(Object other) |
double |
getArea()
Returns the area covered by the polygon.
|
Rectangle |
getBounds()
Returns the smallest integer rectangle covering all points.
|
abstract Rectangle2D |
getBounds2D()
Returns the smallest rectangle covering all points.
|
Point2D |
getGravity0()
Returns the center of gravity of all points.
|
Point2D |
getGravity1()
Returns the center of gravity of all segments.
|
Point2D |
getGravity2()
Returns the gravity center of the area covered by the polygon.
|
abstract int |
getNumberOfPoints()
Returns the number of points in the polygon.
|
PathIterator |
getPathIterator(AffineTransform transform)
Returns an iterator that runs along the boundary of this
Shape . |
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
Returns an iterator that runs along a flattened boundary of this
Shape . |
abstract Point2D |
getPoint(int index)
Returns a specific point (0 <= index < getNumberOfPoints()).
|
abstract Point2D[] |
getPoints()
Returns the array of points.
|
boolean |
intersects(double x,
double y,
double width,
double height)
Determines whether a rectangle has points in common with this
Shape . |
boolean |
intersects(Rectangle2D r)
Determines whether a rectangle has points in common with this
Shape . |
String |
toString()
Returns a string representation of this polygon.
|
protected IlvPolygon2D()
IlvPolygon2D.Float
or IlvPolygon2D.Double
.public abstract int getNumberOfPoints()
public abstract Point2D getPoint(int index)
public abstract Point2D[] getPoints()
public Rectangle getBounds()
public abstract Rectangle2D getBounds2D()
getBounds2D
in interface Shape
public boolean containsInInterior(double x, double y)
x
- The x coordinate of the point to be tested.y
- The y coordinate of the point to be tested.public boolean containsInClosure(double x, double y)
x
- The x coordinate of the point to be tested.y
- The y coordinate of the point to be tested.public boolean contains(double x, double y)
Shape
.public boolean contains(Point2D p)
Shape
.public boolean intersects(double x, double y, double width, double height)
Shape
.intersects
in interface Shape
public boolean intersects(Rectangle2D r)
Shape
.intersects
in interface Shape
public boolean contains(double x, double y, double width, double height)
Shape
.public boolean contains(Rectangle2D r)
Shape
.public PathIterator getPathIterator(AffineTransform transform)
Shape
.getPathIterator
in interface Shape
public PathIterator getPathIterator(AffineTransform at, double flatness)
Shape
.getPathIterator
in interface Shape
public boolean containsInConvexHull(Point2D point)
point
- The point to be tested.public double getArea()
public Point2D getGravity0()
public Point2D getGravity1()
public Point2D getGravity2()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.