- data VertexType
- data Vertex = Vtx {}
- type MonotoneSegment = ([Int], [Int])
- type Separation = (Ordering, Int, Int)
- between :: Angle -> (Angle, Angle) -> Bool
- (+<) :: Angle -> Angle -> Angle
- alerp :: Angle -> Angle -> Float -> Angle
- pairsWith :: (a -> a -> b) -> Vector a -> Vector b
- edges :: Vector V2 -> Vector V2
- angles :: Vector V2 -> Vector Angle
- area :: Vector V2 -> Float
- centroid :: Vector V2 -> V2
- moment :: Vector V2 -> Float
- convexHull :: Vector V2 -> Vector V2
- monotoneDecomposition :: Vector V2 -> [MonotoneSegment]
- monotoneTriangulation :: Vector V2 -> MonotoneSegment -> [(Int, Int, Int)]
- triangulation :: Vector V2 -> [(Int, Int, Int)]
- convexSeparation :: Vector V2 -> Vector V2 -> Bool -> Maybe (Float, Float, Separation, V2, V2)
Documentation
type MonotoneSegment = ([Int], [Int])Source
type Separation = (Ordering, Int, Int)Source
between :: Angle -> (Angle, Angle) -> BoolSource
Checking whether an angle is within a given interval.
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.
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).
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.
:: 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
.