Table of Contents

Class FlipcodeDecomposer

Namespace
Alis.Core.Physic.Common.Decomposition
Assembly
Alis.dll

Convex decomposition algorithm created by unknown Properties:

internal static class FlipcodeDecomposer

Inheritance

Inherited Members

Fields

_tmpA

The tmp

private static Vector2 _tmpA

Field Value

Vector2

_tmpB

The tmp

private static Vector2 _tmpB

Field Value

Vector2

_tmpC

The tmp

private static Vector2 _tmpC

Field Value

Vector2

Methods

ConvexPartition(Vertices)

Decompose the polygon into triangles. Properties:

  • Only works on counter clockwise polygons
public static List<Vertices> ConvexPartition(Vertices vertices)

Parameters

vertices Vertices

The list of points describing the polygon

Returns

List<Vertices>

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

a Vector2

The A point.

b Vector2

The B point.

c Vector2

The C point.

p Vector2

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

contour Vertices

The list of points defining the polygon

u int

The index of the first point

v int

The index of the second point

w int

The index of the third point

n int

The number of elements in the array.

V int[]

The array to populate with indicies of triangles.

Returns

bool

True if a triangle was found