triangulation-0.3: triangulation of polygons

Graphics.Triangulation.GJPTriangulation

Synopsis

# Documentation

data VertexType Source

Constructors

 TopCap BottomCap TopCup BottomCup Side

Instances

 Show VertexType

data Vertex Source

Constructors

 Vtx Fieldsidx :: Int prev :: Int next :: Int vtype :: VertexType px :: Float py :: Float

Instances

 Show Vertex

between :: Angle -> (Angle, Angle) -> BoolSource

Checking whether an angle is within a given interval.

The sum of two angles.

alerp :: Angle -> Angle -> Float -> AngleSource

Linear interpolation between two angles along the smaller arc.

pairsWith :: (a -> a -> b) -> Vector a -> Vector bSource

Applying a binary function to consecutive pairs in a vector with wrap-around.

The edge vectors of a polygon given as a list of vertices.

The absolute angles (with respect to the x axis) of the edges of a polygon given as a list of vertices.

The signed area of a simple polygon (positive if vertices are in counter-clockwise order).

The centroid of a simple polygon.

The moment of inertia of a simple polygon with respect to the origin.

The convex hull of a collection of vertices in counter-clockwise order. (Andrew's Monotone Chain Algorithm)

Monotone decomposition of a simple polygon.

Triangulation of a monotone polygon.

triangulation :: Vector V2 -> [(Int, Int, Int)]Source

Triangulation of a simple polygon.

Arguments

 :: Vector V2 The vertices of the first polygon (vs1) -> Vector V2 The vertices of the second polygon (vs2) -> Bool Whether we are only interested in overlapping -> Maybe (Float, Float, Separation, V2, V2)

A 5-tuple `(d2,ds,sep,v1,v2)` that provides distance information on two convex polygons, where `d2` is the square of the distance, `ds` is its sign (negative in case of penetration), `sep` describes the opposing features, while `v1` and `v2` are the absolute coordinates of the deepest points within the opposite polygon. If the third parameter is `True`, only negative distances are reported, and the function yields `Nothing` for non-overlapping polygons. This is more efficient if we are only interested in collisions, since the computation can be cancelled upon finding the first separating axis. If the third parameter is `False`, the result cannot be `Nothing`.