Méthode | Description | |
---|---|---|
ConvexPartition ( Vertices vertices, float tolerance = 0.001f ) : List |
Decompose the polygon into several smaller non-concave polygon. Each resulting polygon will have no more than Settings.MaxPolygonVertices vertices.
|
Méthode | Description | |
---|---|---|
IsEar ( int i, float xv, float yv, int xvLength ) : bool |
Checks if vertex i is the tip of an ear in polygon defined by xv[] and yv[]. Assumes clockwise orientation of polygon. |
|
Remainder ( int x, int modulus ) : int |
Fix for obnoxious behavior for the % operator for negative numbers...
|
|
ResolvePinchPoint ( Vertices pin, Vertices &poutA, Vertices &poutB, float tolerance ) : bool |
Finds and fixes "pinch points," points where two polygon vertices are at the same point. If a pinch point is found, pin is broken up into poutA and poutB and true is returned; otherwise, returns false. Mostly for internal use. O(N^2) time, which sucks...
|
|
TriangulatePolygon ( Vertices vertices, float tolerance ) : List |
Triangulates a polygon using simple ear-clipping algorithm. Returns size of Triangle array unless the polygon can't be triangulated. This should only happen if the polygon self-intersects, though it will not _always_ return null for a bad polygon - it is the caller's responsibility to check for self-intersection, and if it doesn't, it should at least check that the return value is non-null before using. You're warned! Triangles may be degenerate, especially if you have identical points in the input to the algorithm. Check this before you use them. This is totally unoptimized, so for large polygons it should not be part of the simulation loop. Only works on simple polygons. |
public static ConvexPartition ( Vertices vertices, float tolerance = 0.001f ) : List |
||
vertices | Vertices | The vertices. |
tolerance | float | The tolerance. |
Résultat | List |