hgeometry-0.11.0.0: Geometric Algorithms, Data structures, and Data types.

Data.Geometry.Triangle

Synopsis

# Documentation

data Triangle d p r Source #

Triangles in $$d$$-dimensional space.

Constructors

 Triangle !(Point d r :+ p) !(Point d r :+ p) !(Point d r :+ p)
Instances

pattern Triangle' :: Point d r -> Point d r -> Point d r -> Triangle d () r Source #

convenience function to construct a triangle without associated data.

area :: Fractional r => Triangle 2 p r -> r Source #

Compute the area of a triangle

doubleArea :: Num r => Triangle 2 p r -> r Source #

2*the area of a triangle.

isDegenerateTriangle :: (Num r, Eq r) => Triangle 2 p r -> Bool Source #

Checks if the triangle is degenerate, i.e. has zero area.

inscribedDisk :: (Eq r, Fractional r) => Triangle 2 p r -> Maybe (Disk () r) Source #

get the inscribed disk. Returns Nothing if the triangle is degenerate, i.e. if the points are colinear.

toBarricentric :: Fractional r => Point 2 r -> Triangle 2 p r -> Vector 3 r Source #

Given a point q and a triangle, q inside the triangle, get the baricentric cordinates of q

fromBarricentric :: (Arity d, Num r) => Vector 3 r -> Triangle d p r -> Point d r Source #

Given a vector of barricentric coordinates and a triangle, get the corresponding point in the same coordinate sytsem as the vertices of the triangle.

inTriangle :: (Ord r, Fractional r) => Point 2 r -> Triangle 2 p r -> PointLocationResult Source #

Tests if a point lies inside a triangle, on its boundary, or outside the triangle

onTriangle :: (Ord r, Fractional r) => Point 2 r -> Triangle 2 p r -> Bool Source #

Test if a point lies inside or on the boundary of a triangle