toxi.geom
Class Polygon2D
java.lang.Object
toxi.geom.Polygon2D
public class Polygon2D
- extends java.lang.Object
Wrapper
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
vertices
public java.util.List<Vec2D> vertices
Polygon2D
public Polygon2D()
Polygon2D
public Polygon2D(java.util.List<Vec2D> points)
add
public Polygon2D add(Vec2D p)
getArea
public float getArea()
- Computes the area of the polygon, provided it isn't self intersecting.
Code ported from:
http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
- Returns:
- polygon area
getCentroid
public Vec2D getCentroid()
- Computes the polygon's centre of mass. Code ported from:
http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
- Returns:
- centroid point
getNumPoints
public int getNumPoints()
- Returns the number of polygon vertices.
- Returns:
- vertex count