hgeometry:kernel
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2021

HGeometry.Triangle

Description

Data types to represent Triangles

Synopsis

Documentation

data Triangle point where Source #

Triangles in d-dimensional space

Bundled Patterns

pattern Triangle :: point -> point -> point -> Triangle point

Construct a triangle from its three points

Instances

Instances details
Foldable1 Triangle Source # 
Instance details

Defined in HGeometry.Triangle

Methods

fold1 :: Semigroup m => Triangle m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Triangle a -> m #

foldMap1' :: Semigroup m => (a -> m) -> Triangle a -> m #

toNonEmpty :: Triangle a -> NonEmpty a #

maximum :: Ord a => Triangle a -> a #

minimum :: Ord a => Triangle a -> a #

head :: Triangle a -> a #

last :: Triangle a -> a #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Triangle a -> b #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Triangle a -> b #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Triangle a -> b #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Triangle a -> b #

Functor Triangle Source # 
Instance details

Defined in HGeometry.Triangle

Methods

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

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

Foldable Triangle Source # 
Instance details

Defined in HGeometry.Triangle

Methods

fold :: Monoid m => Triangle m -> m #

foldMap :: Monoid m => (a -> m) -> Triangle a -> m #

foldMap' :: Monoid m => (a -> m) -> Triangle a -> m #

foldr :: (a -> b -> b) -> b -> Triangle a -> b #

foldr' :: (a -> b -> b) -> b -> Triangle a -> b #

foldl :: (b -> a -> b) -> b -> Triangle a -> b #

foldl' :: (b -> a -> b) -> b -> Triangle a -> b #

foldr1 :: (a -> a -> a) -> Triangle a -> a #

foldl1 :: (a -> a -> a) -> Triangle a -> a #

toList :: Triangle a -> [a] #

null :: Triangle a -> Bool #

length :: Triangle a -> Int #

elem :: Eq a => a -> Triangle a -> Bool #

maximum :: Ord a => Triangle a -> a #

minimum :: Ord a => Triangle a -> a #

sum :: Num a => Triangle a -> a #

product :: Num a => Triangle a -> a #

Traversable Triangle Source # 
Instance details

Defined in HGeometry.Triangle

Methods

traverse :: Applicative f => (a -> f b) -> Triangle a -> f (Triangle b) #

sequenceA :: Applicative f => Triangle (f a) -> f (Triangle a) #

mapM :: Monad m => (a -> m b) -> Triangle a -> m (Triangle b) #

sequence :: Monad m => Triangle (m a) -> m (Triangle a) #

Traversable1 Triangle Source # 
Instance details

Defined in HGeometry.Triangle

Methods

traverse1 :: Apply f => (a -> f b) -> Triangle a -> f (Triangle b) Source #

sequence1 :: Apply f => Triangle (f b) -> f (Triangle b) Source #

Generic (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Associated Types

type Rep (Triangle point) 
Instance details

Defined in HGeometry.Triangle

type Rep (Triangle point) = D1 ('MetaData "Triangle" "HGeometry.Triangle" "hgeometry-1.0.0.0-inplace-kernel" 'True) (C1 ('MetaCons "MkTriangle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 3 point))))

Methods

from :: Triangle point -> Rep (Triangle point) x #

to :: Rep (Triangle point) x -> Triangle point #

Read point => Read (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Show point => Show (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

showsPrec :: Int -> Triangle point -> ShowS #

show :: Triangle point -> String #

showList :: [Triangle point] -> ShowS #

Eq (Vector 3 point) => Eq (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

(==) :: Triangle point -> Triangle point -> Bool #

(/=) :: Triangle point -> Triangle point -> Bool #

Ord (Vector 3 point) => Ord (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

compare :: Triangle point -> Triangle point -> Ordering #

(<) :: Triangle point -> Triangle point -> Bool #

(<=) :: Triangle point -> Triangle point -> Bool #

(>) :: Triangle point -> Triangle point -> Bool #

(>=) :: Triangle point -> Triangle point -> Bool #

max :: Triangle point -> Triangle point -> Triangle point #

min :: Triangle point -> Triangle point -> Triangle point #

(Point_ point d r, Ord (Vector d r)) => IsBoxable (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

boundingBox :: forall (d0 :: Nat) r0. (d0 ~ Dimension (Triangle point), r0 ~ NumType (Triangle point), Ord r0) => Triangle point -> Box (Point d0 r0) Source #

(DefaultTransformByConstraints (Triangle point) d r, Point_ point d r) => IsTransformable (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

transformBy :: Transformation (Dimension (Triangle point)) (NumType (Triangle point)) -> Triangle point -> Triangle point Source #

HasVertices' (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Associated Types

type Vertex (Triangle point) 
Instance details

Defined in HGeometry.Triangle

type Vertex (Triangle point) = point
type VertexIx (Triangle point) 
Instance details

Defined in HGeometry.Triangle

type VertexIx (Triangle point) = Int
Reversing (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

reversing :: Triangle point -> Triangle point Source #

Point_ vertex 3 r => CanComputeNormalVector (Triangle vertex) r Source # 
Instance details

Defined in HGeometry.Direction

Methods

normalUnitVectorAt :: forall point (d :: Nat). (Point_ point d r, Has_ Metric_ d r, d ~ Dimension (Triangle vertex), Radical r, Fractional r) => point -> Triangle vertex -> Vector d r Source #

normalVectorAt :: forall point (d :: Nat). (Point_ point d r, d ~ Dimension (Triangle vertex), Num r) => point -> Triangle vertex -> Vector d r Source #

Point_ point (Dimension point) (NumType point) => Triangle_ (Triangle point) point Source # 
Instance details

Defined in HGeometry.Triangle

Methods

mkTriangle :: point -> point -> point -> Triangle point Source #

corners :: Lens' (Triangle point) (Vector 3 point) Source #

(Point_ point 3 r, Point_ point' 3 r, Fractional r, Ord r) => HasIntersectionWith (HalfLine point) (Triangle point') Source # 
Instance details

Defined in HGeometry.Triangle

Methods

intersects :: HalfLine point -> Triangle point' -> Bool Source #

(Point_ point 3 r, Point_ point' 3 r, Fractional r, Ord r) => IsIntersectableWith (HalfLine point) (Triangle point') Source # 
Instance details

Defined in HGeometry.Triangle

Methods

intersect :: HalfLine point -> Triangle point' -> Intersection (HalfLine point) (Triangle point') Source #

HasVertices (Triangle point) (Triangle point') Source # 
Instance details

Defined in HGeometry.Triangle

Methods

vertices :: IndexedTraversal1 (VertexIx (Triangle point)) (Triangle point) (Triangle point') (Vertex (Triangle point)) (Vertex (Triangle point')) Source #

HasPoints (Triangle point) (Triangle point') point point' Source # 
Instance details

Defined in HGeometry.Triangle

Methods

allPoints :: forall (d :: Nat) r r'. (Point_ point d r, Point_ point' d r', NumType (Triangle point) ~ r, NumType (Triangle point') ~ r', Dimension (Triangle point) ~ d, Dimension (Triangle point') ~ d) => Traversal1 (Triangle point) (Triangle point') point point' #

(Point_ point 3 r, Fractional r, Ord r) => HasIntersectionWith (LinePV 3 r) (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

intersects :: LinePV 3 r -> Triangle point -> Bool Source #

(Point_ point 2 r, Num r, Ord r) => HasIntersectionWith (Point 2 r) (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

intersects :: Point 2 r -> Triangle point -> Bool Source #

(Point_ point 3 r, Fractional r, Ord r) => IsIntersectableWith (LinePV 3 r) (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

intersect :: LinePV 3 r -> Triangle point -> Intersection (LinePV 3 r) (Triangle point) Source #

type Rep (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

type Rep (Triangle point) = D1 ('MetaData "Triangle" "HGeometry.Triangle" "hgeometry-1.0.0.0-inplace-kernel" 'True) (C1 ('MetaCons "MkTriangle" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 3 point))))
type Dimension (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

type Dimension (Triangle point) = Dimension point
type NumType (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

type NumType (Triangle point) = NumType point
type Vertex (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

type Vertex (Triangle point) = point
type VertexIx (Triangle point) Source # 
Instance details

Defined in HGeometry.Triangle

type VertexIx (Triangle point) = Int
type Intersection (HalfLine point) (Triangle point') Source #

Same here, we also return the parameter at which the ray intersects the point

Instance details

Defined in HGeometry.Triangle

type Intersection (HalfLine point) (Triangle point') = Maybe (LineTriangleIntersection (Point 3 (NumType point) :+ NumType point) (ClosedLineSegment (Point 3 (NumType point) :+ NumType point)))
type Intersection (LinePV 3 r) (Triangle point') Source #

The extra value is the parameter t so that the intersection point is line^.anchor + t*line^.direction

Instance details

Defined in HGeometry.Triangle

data LineTriangleIntersection point seg Source #

Data type desciribn the intersection between an oriented line in R^3 and a triangle

Instances

Instances details
Bifunctor LineTriangleIntersection Source # 
Instance details

Defined in HGeometry.Triangle

Functor (LineTriangleIntersection point) Source # 
Instance details

Defined in HGeometry.Triangle

Methods

fmap :: (a -> b) -> LineTriangleIntersection point a -> LineTriangleIntersection point b #

(<$) :: a -> LineTriangleIntersection point b -> LineTriangleIntersection point a #

(Show point, Show seg) => Show (LineTriangleIntersection point seg) Source # 
Instance details

Defined in HGeometry.Triangle

(Eq point, Eq seg) => Eq (LineTriangleIntersection point seg) Source # 
Instance details

Defined in HGeometry.Triangle

(Ord point, Ord seg) => Ord (LineTriangleIntersection point seg) Source # 
Instance details

Defined in HGeometry.Triangle