triangulation-0.3: triangulation of polygons

Graphics.Triangulation.GJPTriangulation

Synopsis

Documentation

data Vertex Source

Constructors

Vtx 

Fields

idx :: Int
 
prev :: Int
 
next :: Int
 
vtype :: VertexType
 
px :: Float
 
py :: Float
 

Instances

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

Checking whether an angle is within a given interval.

(+<) :: Angle -> Angle -> AngleSource

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.

edges :: Vector V2 -> Vector V2Source

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

angles :: Vector V2 -> Vector AngleSource

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

area :: Vector V2 -> FloatSource

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

centroid :: Vector V2 -> V2Source

The centroid of a simple polygon.

moment :: Vector V2 -> FloatSource

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

convexHull :: Vector V2 -> Vector V2Source

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

monotoneDecomposition :: Vector V2 -> [MonotoneSegment]Source

Monotone decomposition of a simple polygon.

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

Triangulation of a monotone polygon.

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

Triangulation of a simple polygon.

convexSeparationSource

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.