nicmr / compgeo / Triangulation

This module exposes functions for triangulating polygons.

Polygons in this module are implemented as a List Vec2 that stores an ordered list of corner vertices.

Vertices are implemented as Vec2

Line segments are implemented as (Vec2, Vec2), where the Vec2 represent start and end point of the line segment.

Commonly used

triangulate : List Math.Vector2.Vec2 -> Maybe (List ( Math.Vector2.Vec2, Math.Vector2.Vec2 ))

Triangulates a polygon and returns a list of the edges of the corresponding triangles.

Only works with y-monotone polygons so far, will return Nothing for non-monotone polygons.

isYMonotone : List Math.Vector2.Vec2 -> Basics.Bool

Determines if the passed List Vec2 is y-monotone.