Skip to content

EarClipTriangulator

interludesoftware.tick

Interlude.Tick

EarClipTriangulator Class

Ear-clipping triangulator for simple 2D polygons. Input: List<Vector2> defining the polygon outline (CW or CCW). Output: Unity Mesh with triangles on the XY plane.

public class EarClipTriangulator

Inheritance System.Object → EarClipTriangulator

Methods

EarClipTriangulator.Triangulate(List\<Vector2>) Method

Triangulate a polygon and return a new Mesh. Convenience allocator for one-shot callers and tests; the Drawer's per-frame hot path uses the fill-into-target overload below with a pooled mesh so it allocates nothing.

public static Mesh Triangulate(System.Collections.Generic.List<Vector2> polygon);

Parameters

polygon System.Collections.Generic.List<UnityEngine.Vector2>

Returns

UnityEngine.Mesh

EarClipTriangulator.Triangulate(List\<Vector2>, Mesh) Method

Triangulate a polygon into the supplied result mesh, clearing and refilling it in place. Lets the caller reuse a pooled mesh rather than allocate one per call.

public static void Triangulate(System.Collections.Generic.List<Vector2> polygon, Mesh result);

Parameters

polygon System.Collections.Generic.List<UnityEngine.Vector2>

result UnityEngine.Mesh