| Constructor and Description | 
|---|
Polygon2D()
Creates a new empty polygon. 
 | 
Polygon2D(Collection<Point2D> vertices)
Creates a new polygon from a collection of vertices. 
 | 
Polygon2D(double[] xCoords,
         double[] yCoords)
Creates a new polygon from the coordinates of its vertices. 
 | 
Polygon2D(int n)
Creates a new empty polygon by allocating enough space for storing vertex
 coordinates. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
addVertex(Point2D position)
Adds a new vertex in this polygon 
 | 
double | 
area()
Computes the area of this polygon 
 | 
Box2D | 
boundingBox()
Returns the bounding box of this polygon. 
 | 
Point2D | 
centroid()
Computes the centroid of this polygon 
 | 
boolean | 
contains(Point2D point)
Checks if this polygon contains the query point. 
 | 
ij.gui.PolygonRoi | 
createRoi()
Converts this polygon into an ImageJ Polygon ROI. 
 | 
Point2D | 
getVertex(int index)
Returns index at the specific index 
 | 
Polygon2D | 
invert()
Computes the complementary polygon, whose interior is the exterior of
 this polygon. 
 | 
Iterator<Point2D> | 
iterator()  | 
void | 
setVertex(int i,
         Point2D pos)
Changes vertex coordinate at the specified index 
 | 
double | 
signedArea()
Computes the signed area of this polygon 
 | 
int | 
vertexNumber()
Returns the number of vertices within this polygon 
 | 
ArrayList<Point2D> | 
vertices()  | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic Polygon2D()
public Polygon2D(int n)
n - then number of verticespublic Polygon2D(double[] xCoords,
                 double[] yCoords)
xCoords - the x-coordinates of the verticesyCoords - the y-coordinates of the verticespublic Polygon2D(Collection<Point2D> vertices)
vertices - the polygon verticespublic Box2D boundingBox()
public double area()
signedArea()public double signedArea()
area()public Point2D centroid()
public boolean contains(Point2D point)
point - the polygonpublic Polygon2D invert()
public ij.gui.PolygonRoi createRoi()
public int vertexNumber()
public int addVertex(Point2D position)
position - the position of the new vertexpublic Point2D getVertex(int index)
index - vertex indexpublic void setVertex(int i,
                      Point2D pos)
i - vertex indexpos - the position of the new vertexCopyright © 2014–2023 INRA-IJPB Modeling and Digital Imaging lab. All rights reserved.