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

Data.Geometry.Triangle

Description

Triangles in $$d$$-dimensional space.

Synopsis

# Documentation

data Triangle d p r Source #

A triangle in $$d$$-dimensional space.

Constructors

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

#### Instances

Instances details

_TriangleThreePoints :: Iso' (Triangle d p r) (Three (Point d r :+ p)) Source #

A $$d$$-dimensional triangle is isomorphic to a triple of $$d$$-dimensional points.

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

convenience function to construct a triangle without associated data.

sideSegments :: Triangle d p r -> [LineSegment d p r] Source #

Get the three line-segments that make up the sides of a triangle.

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

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