nicmr/compgeo/1.0.0

NOTE: the latest version is 1.0.3

Triangulation

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 Vec2 -> Maybe (List ( Vec2, 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 Vec2 -> Bool

Determines if the passed polygon is y-monotone