|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.util.nonconvex.Polygon
public class Polygon
Field Summary | |
---|---|
static boolean |
B2_POLYGON_REPORT_ERRORS
|
int |
nVertices
|
float[] |
x
|
float[] |
y
|
Constructor Summary | |
---|---|
Polygon()
|
|
Polygon(float[] _x,
float[] _y)
|
|
Polygon(float[] _x,
float[] _y,
int nVert)
|
|
Polygon(org.jbox2d.util.nonconvex.Triangle t)
|
|
Polygon(Vec2[] v)
|
|
Polygon(Vec2[] v,
int nVert)
|
Method Summary | |
---|---|
void |
addTo(PolygonDef pd)
Adds this polygon to a PolyDef. |
static Polygon |
convexHull(float[] cloudX,
float[] cloudY,
int nVert)
|
static Polygon |
convexHull(Vec2[] v,
int nVert)
Find the convex hull of a point cloud using "Gift-wrap" algorithm - start with an extremal point, and walk around the outside edge by testing angles. |
static int |
decomposeConvex(Polygon p,
Polygon[] results,
int maxPolys)
Decomposes a non-convex polygon into a number of convex polygons, up to maxPolys (remaining pieces are thrown out, but the total number is returned, so the return value can be greater than maxPolys). |
static void |
decomposeConvexAndAddTo(Polygon p,
Body bd,
PolygonDef prototype)
Decomposes a polygon into convex polygons and adds all pieces to a b2BodyDef using a prototype b2PolyDef. |
Vec2[] |
getVertexVecs()
|
boolean |
isConvex()
Assuming the polygon is simple, checks if it is convex. |
boolean |
isSimple()
|
boolean |
isUsable()
|
boolean |
isUsable(boolean printErrors)
Checks if polygon is valid for use in Box2d engine. |
static Vec2 |
polyCentroid(Vec2[] vs,
int count)
|
static int |
polygonizeTriangles(org.jbox2d.util.nonconvex.Triangle[] triangulated,
int triangulatedLength,
Polygon[] polys,
int polysLength)
Turns a list of triangles into a list of convex polygons. |
void |
print()
|
static void |
reversePolygon(float[] x,
float[] y,
int n)
|
static void |
reversePolygon(Polygon p)
|
void |
set(Polygon p)
|
static Polygon |
traceEdge(Polygon p)
|
static int |
triangulatePolygon(float[] xv,
float[] yv,
int vNum,
org.jbox2d.util.nonconvex.Triangle[] results)
Triangulates a polygon using simple ear-clipping algorithm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean B2_POLYGON_REPORT_ERRORS
public int nVertices
public float[] x
public float[] y
Constructor Detail |
---|
public Polygon(float[] _x, float[] _y)
public Polygon(float[] _x, float[] _y, int nVert)
public Polygon(Vec2[] v)
public Polygon(Vec2[] v, int nVert)
public Polygon(org.jbox2d.util.nonconvex.Triangle t)
public Polygon()
Method Detail |
---|
public Vec2[] getVertexVecs()
public void set(Polygon p)
public boolean isConvex()
public static Vec2 polyCentroid(Vec2[] vs, int count)
public boolean isUsable(boolean printErrors)
public boolean isUsable()
public boolean isSimple()
public void addTo(PolygonDef pd)
public static int triangulatePolygon(float[] xv, float[] yv, int vNum, org.jbox2d.util.nonconvex.Triangle[] results)
public static int polygonizeTriangles(org.jbox2d.util.nonconvex.Triangle[] triangulated, int triangulatedLength, Polygon[] polys, int polysLength)
public static void reversePolygon(Polygon p)
public static void reversePolygon(float[] x, float[] y, int n)
public static int decomposeConvex(Polygon p, Polygon[] results, int maxPolys)
public static void decomposeConvexAndAddTo(Polygon p, Body bd, PolygonDef prototype)
public static Polygon convexHull(Vec2[] v, int nVert)
public static Polygon convexHull(float[] cloudX, float[] cloudY, int nVert)
public static Polygon traceEdge(Polygon p)
public void print()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |