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

Safe HaskellNone
LanguageHaskell2010

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
Arity d => Functor (Triangle d p) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

fmap :: (a -> b) -> Triangle d p a -> Triangle d p b #

(<$) :: a -> Triangle d p b -> Triangle d p a #

PointFunctor (Triangle d p) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

pmap :: (Point (Dimension (Triangle d p r)) r -> Point (Dimension (Triangle d p s)) s) -> Triangle d p r -> Triangle d p s Source #

(Fractional r, Ord r) => IsIntersectableWith (Line 2 r) (Triangle 2 p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

intersect :: Line 2 r -> Triangle 2 p r -> Intersection (Line 2 r) (Triangle 2 p r) #

intersects :: Line 2 r -> Triangle 2 p r -> Bool #

nonEmptyIntersection :: proxy (Line 2 r) -> proxy (Triangle 2 p r) -> Intersection (Line 2 r) (Triangle 2 p r) -> Bool #

(Fractional r, Ord r) => IsIntersectableWith (Line 3 r) (Triangle 3 p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

intersect :: Line 3 r -> Triangle 3 p r -> Intersection (Line 3 r) (Triangle 3 p r) #

intersects :: Line 3 r -> Triangle 3 p r -> Bool #

nonEmptyIntersection :: proxy (Line 3 r) -> proxy (Triangle 3 p r) -> Intersection (Line 3 r) (Triangle 3 p r) -> Bool #

(Arity d, Eq r, Eq p) => Eq (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

(==) :: Triangle d p r -> Triangle d p r -> Bool #

(/=) :: Triangle d p r -> Triangle d p r -> Bool #

(Arity d, Read r, Read p) => Read (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

(Arity d, Show r, Show p) => Show (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

showsPrec :: Int -> Triangle d p r -> ShowS #

show :: Triangle d p r -> String #

showList :: [Triangle d p r] -> ShowS #

(Fractional r, Arity d, Arity (d + 1)) => IsTransformable (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

transformBy :: Transformation (Dimension (Triangle d p r)) (NumType (Triangle d p r)) -> Triangle d p r -> Triangle d p r Source #

Num r => HasSupportingPlane (Triangle 3 p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type IntersectionOf (Line 2 r) (Triangle 2 p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type IntersectionOf (Line 2 r) (Triangle 2 p r) = NoIntersection ': (Point 2 r ': (LineSegment 2 () r ': ([] :: [Type])))
type IntersectionOf (Line 3 r) (Triangle 3 p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type IntersectionOf (Line 3 r) (Triangle 3 p r) = NoIntersection ': (Point 3 r ': (LineSegment 3 () r ': ([] :: [Type])))
type NumType (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type NumType (Triangle d p r) = r
type Dimension (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type Dimension (Triangle d p r) = d

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