Class FlipcodeDecomposer
- Assembly
- Alis.dll
Convex decomposition algorithm created by unknown Properties:
- No support for holes
- Very fast
- Only works on simple polygons
- Only works on counter clockwise polygons More information: http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml
internal static class FlipcodeDecomposerInheritance
Inherited Members
Fields
_tmpA
The tmp
private static Vector2 _tmpAField Value
_tmpB
The tmp
private static Vector2 _tmpBField Value
_tmpC
The tmp
private static Vector2 _tmpCField Value
Methods
ConvexPartition(Vertices)
Decompose the polygon into triangles. Properties:
- Only works on counter clockwise polygons
public static List<Vertices> ConvexPartition(Vertices vertices)Parameters
verticesVertices-
The list of points describing the polygon
Returns
InsideTriangle(ref Vector2, ref Vector2, ref Vector2, ref Vector2)
Check if the point P is inside the triangle defined by the points A, B, C
private static bool InsideTriangle(ref Vector2 a, ref Vector2 b, ref Vector2 c, ref Vector2 p)Parameters
aVector2-
The A point.
bVector2-
The B point.
cVector2-
The C point.
pVector2-
The point to be tested.
Returns
- bool
-
True if the point is inside the triangle
Snip(Vertices, int, int, int, int, int[])
Cut a the contour and add a triangle into V to describe the location of the cut
private static bool Snip(Vertices contour, int u, int v, int w, int n, int[] V)Parameters
contourVertices-
The list of points defining the polygon
uint-
The index of the first point
vint-
The index of the second point
wint-
The index of the third point
nint-
The number of elements in the array.
Vint[]-
The array to populate with indicies of triangles.
Returns
- bool
-
True if a triangle was found