hgeometry-0.12.0.2: Geometric Algorithms, Data structures, and Data types.
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Data.Geometry.HalfSpace

Description

\(d\)-dimensional HalfSpaces

Synopsis

Documentation

>>> :{
let myVector :: Vector 3 Int
    myVector = Vector3 1 2 3
    myPoint = Point myVector
:}

newtype HalfSpace d r Source #

A Halfspace in \(d\) dimensions. Note that the intended side of the halfspace is already indicated by the normal vector of the bounding plane.

Constructors

HalfSpace 

Fields

Instances

Instances details
Arity d => Functor (HalfSpace d) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Methods

fmap :: (a -> b) -> HalfSpace d a -> HalfSpace d b #

(<$) :: a -> HalfSpace d b -> HalfSpace d a #

Arity d => Foldable (HalfSpace d) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Methods

fold :: Monoid m => HalfSpace d m -> m #

foldMap :: Monoid m => (a -> m) -> HalfSpace d a -> m #

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

foldr :: (a -> b -> b) -> b -> HalfSpace d a -> b #

foldr' :: (a -> b -> b) -> b -> HalfSpace d a -> b #

foldl :: (b -> a -> b) -> b -> HalfSpace d a -> b #

foldl' :: (b -> a -> b) -> b -> HalfSpace d a -> b #

foldr1 :: (a -> a -> a) -> HalfSpace d a -> a #

foldl1 :: (a -> a -> a) -> HalfSpace d a -> a #

toList :: HalfSpace d a -> [a] #

null :: HalfSpace d a -> Bool #

length :: HalfSpace d a -> Int #

elem :: Eq a => a -> HalfSpace d a -> Bool #

maximum :: Ord a => HalfSpace d a -> a #

minimum :: Ord a => HalfSpace d a -> a #

sum :: Num a => HalfSpace d a -> a #

product :: Num a => HalfSpace d a -> a #

Arity d => Traversable (HalfSpace d) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Methods

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

sequenceA :: Applicative f => HalfSpace d (f a) -> f (HalfSpace d a) #

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

sequence :: Monad m => HalfSpace d (m a) -> m (HalfSpace d a) #

(Arity d, Eq r, Fractional r) => Eq (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Methods

(==) :: HalfSpace d r -> HalfSpace d r -> Bool #

(/=) :: HalfSpace d r -> HalfSpace d r -> Bool #

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

Defined in Data.Geometry.HalfSpace

Methods

showsPrec :: Int -> HalfSpace d r -> ShowS #

show :: HalfSpace d r -> String #

showList :: [HalfSpace d r] -> ShowS #

Generic (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Associated Types

type Rep (HalfSpace d r) :: Type -> Type #

Methods

from :: HalfSpace d r -> Rep (HalfSpace d r) x #

to :: Rep (HalfSpace d r) x -> HalfSpace d r #

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

Defined in Data.Geometry.HalfSpace

(Num r, Ord r, Arity d) => IsIntersectableWith (Point d r) (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

Methods

intersect :: Point d r -> HalfSpace d r -> Intersection (Point d r) (HalfSpace d r) #

intersects :: Point d r -> HalfSpace d r -> Bool #

nonEmptyIntersection :: proxy (Point d r) -> proxy (HalfSpace d r) -> Intersection (Point d r) (HalfSpace d r) -> Bool #

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

Defined in Data.Geometry.HalfSpace

Methods

intersect :: Line 2 r -> HalfSpace 2 r -> Intersection (Line 2 r) (HalfSpace 2 r) #

intersects :: Line 2 r -> HalfSpace 2 r -> Bool #

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

type Rep (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

type Rep (HalfSpace d r) = D1 ('MetaData "HalfSpace" "Data.Geometry.HalfSpace" "hgeometry-0.12.0.2-IMXeR0PuShPEjPCARytEWE" 'True) (C1 ('MetaCons "HalfSpace" 'PrefixI 'True) (S1 ('MetaSel ('Just "_boundingPlane") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HyperPlane d r))))
type NumType (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

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

Defined in Data.Geometry.HalfSpace

type Dimension (HalfSpace d r) = d
type IntersectionOf (Point d r) (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

type IntersectionOf (Line d r) (HalfSpace d r) Source # 
Instance details

Defined in Data.Geometry.HalfSpace

type IntersectionOf (Line d r) (HalfSpace d r) = '[NoIntersection, HalfLine d r, Line d r]

boundingPlane :: forall d r d r. Iso (HalfSpace d r) (HalfSpace d r) (HyperPlane d r) (HyperPlane d r) Source #

leftOf :: Num r => Line 2 r -> HalfPlane r Source #

Get the halfplane left of a line (i.e. "above") a line

>>> leftOf $ horizontalLine 4
HalfSpace {_boundingPlane = HyperPlane {_inPlane = Point2 0 4, _normalVec = Vector2 0 1}}

rightOf :: Num r => Line 2 r -> HalfPlane r Source #

Get the halfplane right of a line (i.e. "below") a line

>>> rightOf $ horizontalLine 4
HalfSpace {_boundingPlane = HyperPlane {_inPlane = Point2 0 4, _normalVec = Vector2 0 (-1)}}

above :: Num r => Line 2 r -> HalfPlane r Source #

below :: Num r => Line 2 r -> HalfPlane r Source #

inHalfSpace :: (Num r, Ord r, Arity d) => Point d r -> HalfSpace d r -> PointLocationResult Source #

Test if a point lies in a halfspace