|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Polygon2D
public class Polygon2D
Container type for convex polygons. Implements Shape2D
.
Field Summary | |
---|---|
java.util.List<Vec2D> |
vertices
|
Constructor Summary | |
---|---|
Polygon2D()
|
|
Polygon2D(java.util.List<Vec2D> points)
|
|
Polygon2D(Vec2D... points)
|
Method Summary | |
---|---|
Polygon2D |
add(Vec2D p)
Adds a new vertex to the polygon (builder pattern). |
boolean |
containsPoint(ReadonlyVec2D p)
Checks if the point is within the given shape. |
Polygon2D |
flipVertexOrder()
Flips the ordering of the polygon's vertices. |
float |
getArea()
Computes the area of the polygon, provided it isn't self intersecting. |
Vec2D |
getCentroid()
Computes the polygon's centre of mass. |
float |
getCircumference()
Computes the shape's circumference. |
int |
getNumPoints()
Returns the number of polygon vertices. |
boolean |
isClockwise()
Checks if the vertices of this polygon are in clockwise ordering by examining the first 3. |
Polygon2D |
reverseOrientation()
Deprecated. |
Polygon2D |
smooth(float amount,
float baseWeight)
Applies a laplacian-style smooth operation to all polygon vertices, causing sharp corners/angles to widen and results in a general smoother shape. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.util.List<Vec2D> vertices
Constructor Detail |
---|
public Polygon2D()
public Polygon2D(java.util.List<Vec2D> points)
public Polygon2D(Vec2D... points)
Method Detail |
---|
public Polygon2D add(Vec2D p)
p
- vertex point to add
public boolean containsPoint(ReadonlyVec2D p)
Shape2D
containsPoint
in interface Shape2D
public Polygon2D flipVertexOrder()
public float getArea()
getArea
in interface Shape2D
public Vec2D getCentroid()
public float getCircumference()
Shape2D
getCircumference
in interface Shape2D
public int getNumPoints()
public boolean isClockwise()
@Deprecated public Polygon2D reverseOrientation()
public Polygon2D smooth(float amount, float baseWeight)
amount
- smooth amount (between 0 < x < 0.5)baseWeight
- counter weight (0 <= x < 1/2 * smooth amount)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |