|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Polygon2D
Represent any class made of a finite set of simply connected edges. This include simple polygons, multiple polygons, or more specialized shapes like rectangles, squares... The boundary of a polygon is a collection of LinearRing2D.
Field Summary |
---|
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Method Summary | |
---|---|
void |
addVertex(Point2D point)
Adds a vertex as last vertex of this polygon. |
double |
area()
Returns the signed area of the polygon. |
CirculinearContourArray2D<? extends LinearRing2D> |
boundary()
Overrides the definition of boundary() such that the boundary of a polygon is defined as a set of LinearRing2D. |
Point2D |
centroid()
Returns the centroid (center of mass) of the polygon. |
Polygon2D |
clip(Box2D box)
Clip the shape with the given box, and returns a new shape. |
int |
closestVertexIndex(Point2D point)
Returns the index of the closest vertex to the input point. |
Polygon2D |
complement()
Returns the complementary polygon. |
java.util.Collection<? extends LinearRing2D> |
contours()
Returns the set of contours that enclose this domain. |
int |
edgeNumber()
Returns the number of edges of the polygon |
java.util.Collection<? extends LineSegment2D> |
edges()
Return the edges as line segments of the polygon |
void |
insertVertex(int index,
Point2D point)
Inserts a vertex at the specified position. |
void |
removeVertex(int index)
Removes the vertex at the given index. |
void |
setVertex(int i,
Point2D point)
Sets the position of the i-th vertex |
Polygon2D |
transform(AffineTransform2D trans)
Returns the new Polygon created by an affine transform of this polygon. |
Point2D |
vertex(int i)
Returns the i-th vertex of the polygon. |
int |
vertexNumber()
Returns the number of vertices of the polygon |
java.util.Collection<Point2D> |
vertices()
Returns the vertices (singular points) of the polygon |
Methods inherited from interface math.geom2d.circulinear.CirculinearDomain2D |
---|
transform |
Methods inherited from interface math.geom2d.circulinear.CirculinearShape2D |
---|
buffer |
Methods inherited from interface math.geom2d.domain.Domain2D |
---|
asPolygon, draw, fill |
Methods inherited from interface math.geom2d.Shape2D |
---|
boundingBox, contains, contains, distance, distance, isBounded, isEmpty |
Methods inherited from interface math.geom2d.GeometricObject2D |
---|
almostEquals |
Method Detail |
---|
java.util.Collection<Point2D> vertices()
Point2D vertex(int i)
i
- index of the vertex, between 0 and the number of verticesvoid setVertex(int i, Point2D point)
i
- the vertex indexpoint
- the new position of the vertex
java.lang.UnsupportedOperationException
- if this polygon implementation does not support vertex
modificationvoid addVertex(Point2D point)
point
- the position of the new vertex
java.lang.UnsupportedOperationException
- if this polygon implementation does not support vertex
modificationvoid insertVertex(int index, Point2D point)
index
- index at which the specified vertex is to be insertedpoint
- the position of the new vertex
java.lang.UnsupportedOperationException
- if this polygon implementation does not support vertex
modificationvoid removeVertex(int index)
index
- index of the vertex to remove
java.lang.UnsupportedOperationException
- if this polygon implementation does not support vertex
modificationint vertexNumber()
int closestVertexIndex(Point2D point)
java.util.Collection<? extends LineSegment2D> edges()
int edgeNumber()
Point2D centroid()
double area()
CirculinearContourArray2D<? extends LinearRing2D> boundary()
boundary
in interface CirculinearDomain2D
boundary
in interface Domain2D
java.util.Collection<? extends LinearRing2D> contours()
Domain2D
contours
in interface CirculinearDomain2D
contours
in interface Domain2D
Contour2D
Polygon2D complement()
complement
in interface CirculinearDomain2D
complement
in interface Domain2D
Polygon2D transform(AffineTransform2D trans)
transform
in interface Domain2D
transform
in interface Shape2D
trans
- an affine transform
Polygon2D clip(Box2D box)
Shape2D
clip
in interface Domain2D
clip
in interface Shape2D
box
- the clipping box
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |