Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Triangle d p r = Triangle (Point d r :+ p) (Point d r :+ p) (Point d r :+ p)
- pattern Triangle' :: Point d r -> Point d r -> Point d r -> Triangle d () r
- sideSegments :: Triangle d p r -> [LineSegment d p r]
- area :: Fractional r => Triangle 2 p r -> r
- doubleArea :: Num r => Triangle 2 p r -> r
- isDegenerateTriangle :: (Num r, Eq r) => Triangle 2 p r -> Bool
- inscribedDisk :: (Eq r, Fractional r) => Triangle 2 p r -> Maybe (Disk () r)
- toBarricentric :: Fractional r => Point 2 r -> Triangle 2 p r -> Vector 3 r
- fromBarricentric :: (Arity d, Num r) => Vector 3 r -> Triangle d p r -> Point d r
- inTriangle :: (Ord r, Fractional r) => Point 2 r -> Triangle 2 p r -> PointLocationResult
- onTriangle :: (Ord r, Fractional r) => Point 2 r -> Triangle 2 p r -> Bool
Documentation
Triangles in \(d\)-dimensional space.
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.
sideSegments :: Triangle d p r -> [LineSegment d p r] Source #
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