|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--drasys.or.geom.rect2.Rect2 | +--drasys.or.geom.rect2.Polygon
An implementation of a polygon with optional holes in the 2D rectangular coordinate system. This polygon is a container object, it holds the points that define the vertices of the polygon. The points must be objects that implement the PointI interface and have immutable coordinates. The polygon also contains a set of polygons that represent holes in the polygon.
Constructor Summary | |
Polygon(PointI[] vertices)
|
|
Polygon(PointI[] vertices,
PolygonI[] holes)
|
Method Summary | |
PointI |
centroid()
Returns the point at the mean X and Y for the vertices, the holes are ignored. |
double |
distanceProxyTo(PointI point)
Returns an easily computable proxy that can be used to compare the distance from the polygon border to the point argument. |
double |
distanceTo(PointI point)
Returns the distance from the polygon border to the point argument. |
boolean |
equals(java.lang.Object o)
Returns true if the points and all the holes in each polygon are equal. |
PointI |
getPoint(int index)
Returns the point at 'index' from the polygon. |
int |
hashCode()
|
java.util.Enumeration |
holes()
Returns an enumeration on the holes of the polygon. |
double |
length()
Returns the length of the border of the polygon. |
PointI |
nearestPointTo(PointI point)
Returns the point along the polygon border that is closest to the argument. |
PointI |
point(int index)
Returns the point at 'index'; |
RangeI |
range()
|
int |
sizeOfHoles()
Returns the number of holes in the polygon. |
int |
sizeOfVertices()
Returns the number of vertices in the polygon. |
java.lang.String |
toString()
|
java.util.Enumeration |
vertices()
Returns an enumeration on the vertices of the polygon. |
Methods inherited from class drasys.or.geom.rect2.Rect2 |
coordinateSystem,
getCentroid,
getDistanceProxyTo,
getDistanceTo,
getNearestPointTo,
getRange |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Polygon(PointI[] vertices)
public Polygon(PointI[] vertices, PolygonI[] holes)
Method Detail |
public PointI point(int index)
public RangeI range()
public PointI centroid()
public int sizeOfVertices()
public int sizeOfHoles()
public PointI getPoint(int index)
public java.util.Enumeration vertices()
public java.util.Enumeration holes()
public PointI nearestPointTo(PointI point)
public double distanceTo(PointI point)
public double distanceProxyTo(PointI point)
public double length()
public int hashCode()
public boolean equals(java.lang.Object o)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |