hgeometry-0.12.0.2: Geometric Algorithms, Data structures, and Data types.
Safe HaskellNone
LanguageHaskell2010

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

Defined in Data.Geometry.Triangle

Methods

bimap :: (a -> b) -> (c -> d0) -> Triangle d a c -> Triangle d b d0 #

first :: (a -> b) -> Triangle d a c -> Triangle d b c #

second :: (b -> c) -> Triangle d a b -> Triangle d a c #

Arity d => Bitraversable (Triangle d) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d0) -> Triangle d a b -> f (Triangle d c d0) #

Arity d => Bifoldable (Triangle d) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

bifold :: Monoid m => Triangle d m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Triangle d a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Triangle d a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Triangle d a b -> c #

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 #

Generic (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

Associated Types

type Rep (Triangle d p r) :: Type -> Type #

Methods

from :: Triangle d p r -> Rep (Triangle d p r) x #

to :: Rep (Triangle d p r) x -> Triangle d p r #

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

Defined in Data.Geometry.Triangle

Methods

rnf :: Triangle d p r -> () #

(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 #

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

Defined in Data.Geometry.Triangle

Methods

boundingBox :: Triangle d p r -> Box (Dimension (Triangle d p r)) () (NumType (Triangle d p r)) Source #

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

Defined in Data.Geometry.Triangle

Field1 (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

_1 :: Lens (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) #

Field2 (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

_2 :: Lens (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) #

Field3 (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) Source # 
Instance details

Defined in Data.Geometry.Triangle

Methods

_3 :: Lens (Triangle d p r) (Triangle d p r) (Point d r :+ p) (Point d r :+ p) #

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 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 Rep (Triangle d p r) Source # 
Instance details

Defined in Data.Geometry.Triangle

type Rep (Triangle d p r) = D1 ('MetaData "Triangle" "Data.Geometry.Triangle" "hgeometry-0.12.0.2-IMXeR0PuShPEjPCARytEWE" 'False) (C1 ('MetaCons "Triangle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point d r :+ p)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point d r :+ p)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Point d r :+ p)))))
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

_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 #