Table of Contents

Class BayazitDecomposer

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

Convex decomposition algorithm created by Mark Bayazit (http://mnbayazit.com/) Properties:

  • Tries to decompose using polygons instead of triangles.
  • Tends to produce optimal results with low processing time.
  • Running time is O(nr), n = number of vertices, r = reflex vertices.
  • Does not support holes. For more information about this algorithm, see http://mnbayazit.com/406/bayazit
internal static class BayazitDecomposer

Inheritance

Inherited Members

Methods

At(int, Vertices)

Ats the i

private static Vector2 At(int i, Vertices vertices)

Parameters

i int

The

vertices Vertices

The vertices

Returns

Vector2

The vector

CanSee(int, int, Vertices)

Describes whether can see

private static bool CanSee(int i, int j, Vertices vertices)

Parameters

i int

The

j int

The

vertices Vertices

The vertices

Returns

bool

The bool

ConvexPartition(Vertices)

Decompose the polygon into several smaller non-concave polygon. If the polygon is already convex, it will return the original polygon, unless it is over Settings.MaxPolygonVertices.

public static List<Vertices> ConvexPartition(Vertices vertices)

Parameters

vertices Vertices

Returns

List<Vertices>

Copy(int, int, Vertices)

Copies the i

private static Vertices Copy(int i, int j, Vertices vertices)

Parameters

i int

The

j int

The

vertices Vertices

The vertices

Returns

Vertices

The

Left(Vector2, Vector2, Vector2)

Describes whether left

private static bool Left(Vector2 a, Vector2 b, Vector2 c)

Parameters

a Vector2

The

b Vector2

The

c Vector2

The

Returns

bool

The bool

LeftOn(Vector2, Vector2, Vector2)

Describes whether left on

private static bool LeftOn(Vector2 a, Vector2 b, Vector2 c)

Parameters

a Vector2

The

b Vector2

The

c Vector2

The

Returns

bool

The bool

Reflex(int, Vertices)

Describes whether reflex

private static bool Reflex(int i, Vertices vertices)

Parameters

i int

The

vertices Vertices

The vertices

Returns

bool

The bool

Right(int, Vertices)

Describes whether right

private static bool Right(int i, Vertices vertices)

Parameters

i int

The

vertices Vertices

The vertices

Returns

bool

The bool

Right(Vector2, Vector2, Vector2)

Describes whether right

private static bool Right(Vector2 a, Vector2 b, Vector2 c)

Parameters

a Vector2

The

b Vector2

The

c Vector2

The

Returns

bool

The bool

RightOn(Vector2, Vector2, Vector2)

Describes whether right on

private static bool RightOn(Vector2 a, Vector2 b, Vector2 c)

Parameters

a Vector2

The

b Vector2

The

c Vector2

The

Returns

bool

The bool

SquareDist(Vector2, Vector2)

Squares the dist using the specified a

private static float SquareDist(Vector2 a, Vector2 b)

Parameters

a Vector2

The

b Vector2

The

Returns

float

The float

TriangulatePolygon(Vertices)

Triangulates the polygon using the specified vertices

private static List<Vertices> TriangulatePolygon(Vertices vertices)

Parameters

vertices Vertices

The vertices

Returns

List<Vertices>

The list