hgeometry-kernel
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2024

HGeometry.Box

Description

d-dimensional Boxes

Synopsis

Documentation

fromExtent :: forall vector (d :: Nat) interval r. (Vector_ vector d interval, ClosedInterval_ interval r, Has_ Additive_ d r, Has_ Vector_ d interval, HasComponents (Vector d interval) (Vector d r)) => vector -> Box (Point d r) Source #

Given a vector of intervals, construct a box.

>>> fromExtent (Vector2 (ClosedInterval 1 2) (ClosedInterval 10 20))
Box (Point2 1 10) (Point2 2 20)

data Box point where Source #

D-dimensional boxes.

A box is represented by two points; a point with lexicographically minimal coordinates, and a point with lexicographically maximal coordinates.

Bundled Patterns

pattern Box :: point -> point -> Box point

Construct a box

pattern Rect :: Num r => r -> r -> r -> r -> Rectangle (Point 2 r)

Given x y w h construct the rectangle with bottom left corner (x,y), width w, and hegith h.

pattern Rectangle :: Dimension point ~ 2 => point -> point -> Box point

Construct a Rectangle

Instances

Instances details
Functor Box Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

fmap :: (a -> b) -> Box a -> Box b Source #

(<$) :: a -> Box b -> Box a Source #

Foldable Box Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

fold :: Monoid m => Box m -> m Source #

foldMap :: Monoid m => (a -> m) -> Box a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Box a -> b Source #

foldr' :: (a -> b -> b) -> b -> Box a -> b Source #

foldl :: (b -> a -> b) -> b -> Box a -> b Source #

foldl' :: (b -> a -> b) -> b -> Box a -> b Source #

foldr1 :: (a -> a -> a) -> Box a -> a Source #

foldl1 :: (a -> a -> a) -> Box a -> a Source #

toList :: Box a -> [a] Source #

null :: Box a -> Bool Source #

length :: Box a -> Int Source #

elem :: Eq a => a -> Box a -> Bool Source #

maximum :: Ord a => Box a -> a Source #

minimum :: Ord a => Box a -> a Source #

sum :: Num a => Box a -> a Source #

product :: Num a => Box a -> a Source #

Traversable Box Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

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

sequenceA :: Applicative f => Box (f a) -> f (Box a) Source #

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

sequence :: Monad m => Box (m a) -> m (Box a) Source #

Generic (Box point) Source # 
Instance details

Defined in HGeometry.Box.Internal

Associated Types

type Rep (Box point) 
Instance details

Defined in HGeometry.Box.Internal

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

Methods

from :: Box point -> Rep (Box point) x Source #

to :: Rep (Box point) x -> Box point Source #

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

Defined in HGeometry.Box.Internal

Methods

readsPrec :: Int -> ReadS (Box point) Source #

readList :: ReadS [Box point] Source #

readPrec :: ReadPrec (Box point) Source #

readListPrec :: ReadPrec [Box point] Source #

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

Defined in HGeometry.Box.Internal

Methods

showsPrec :: Int -> Box point -> ShowS Source #

show :: Box point -> String Source #

showList :: [Box point] -> ShowS Source #

Eq point => Eq (Box point) Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

(==) :: Box point -> Box point -> Bool Source #

(/=) :: Box point -> Box point -> Bool Source #

Ord point => Ord (Box point) Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

compare :: Box point -> Box point -> Ordering Source #

(<) :: Box point -> Box point -> Bool Source #

(<=) :: Box point -> Box point -> Bool Source #

(>) :: Box point -> Box point -> Bool Source #

(>=) :: Box point -> Box point -> Bool Source #

max :: Box point -> Box point -> Box point Source #

min :: Box point -> Box point -> Box point Source #

(Box_ (Box point) point, Point_ point d r) => IsBoxable (Box point) Source # 
Instance details

Defined in HGeometry.Box.Boxable

Methods

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

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

Defined in HGeometry.Box

Methods

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

(Point_ point d r, Zip (Vector d)) => Box_ (Box point) point Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

extent :: forall r0 (d0 :: Nat). (r0 ~ NumType (Box point), d0 ~ Dimension (Box point), Num r0) => Box point -> Vector d0 (ClosedInterval r0) Source #

HasMaxPoint (Box point) point Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

maxPoint :: Lens' (Box point) point Source #

HasMinPoint (Box point) point Source # 
Instance details

Defined in HGeometry.Box.Internal

Methods

minPoint :: Lens' (Box point) point Source #

(Ord r, Num r, Point_ point d r, HasComponents (Vector d (Interval_x_IntervalIntersection r (ClosedInterval r))) (Vector d (ClosedInterval r)), HasComponents (Vector d (ClosedInterval r)) (Vector d r), Has_ Vector_ d (ClosedInterval r), Has_ Additive_ d r, Traversable (Vector d), Applicative (Vector d), Zip (Vector d)) => HasIntersectionWith (Box point) (Box point) Source # 
Instance details

Defined in HGeometry.Box.Intersection

Methods

intersects :: Box point -> Box point -> Bool Source #

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

Defined in HGeometry.Box

Methods

intersects :: HalfLine point -> Rectangle point -> Bool Source #

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

Defined in HGeometry.Box

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

Defined in HGeometry.Box

Methods

intersects :: LineEQ r -> Rectangle point -> Bool Source #

(Point_ point d r, Ord r, Num r, HasComponents (Vector d (Interval_x_IntervalIntersection r (ClosedInterval r))) (Vector d (ClosedInterval r)), HasComponents (Vector d (ClosedInterval r)) (Vector d r), Has_ Vector_ d (ClosedInterval r), Has_ Additive_ d r, Traversable (Vector d), Applicative (Vector d), Zip (Vector d)) => IsIntersectableWith (Box point) (Box point) Source # 
Instance details

Defined in HGeometry.Box.Intersection

Methods

intersect :: Box point -> Box point -> Intersection (Box point) (Box point) Source #

(Point_ point 2 r, Ord r, Fractional r) => IsIntersectableWith (HalfLine point) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

Methods

intersect :: HalfLine point -> Rectangle point -> Intersection (HalfLine point) (Rectangle point) Source #

(Fractional r, Ord r, Point_ point 2 r) => IsIntersectableWith (VerticalOrLineEQ r) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

(Fractional r, Ord r, Point_ point 2 r) => IsIntersectableWith (LineEQ r) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

Methods

intersect :: LineEQ r -> Rectangle point -> Intersection (LineEQ r) (Rectangle point) Source #

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

Defined in HGeometry.Box.Internal

Methods

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

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

Defined in HGeometry.Box

Methods

intersects :: LinePV 2 r -> Rectangle point -> Bool Source #

(Ord r, Num r, Point_ point 2 r, Point_ point' 2 r, HasIntersectionWith (LineSegment endPoint point) (ClosedLineSegment point')) => HasIntersectionWith (LineSegment endPoint point) (Boundary (Rectangle point')) Source # 
Instance details

Defined in HGeometry.Box

Methods

intersects :: LineSegment endPoint point -> Boundary (Rectangle point') -> Bool Source #

(Ord r, Num r, Point_ point 2 r, Point_ point' 2 r, IxValue (endPoint point) ~ point, EndPoint_ (endPoint point), HasIntersectionWith (LineSegment endPoint point) (ClosedLineSegment point')) => HasIntersectionWith (LineSegment endPoint point) (Rectangle point') Source # 
Instance details

Defined in HGeometry.Box

Methods

intersects :: LineSegment endPoint point -> Rectangle point' -> Bool Source #

(Point_ point d r, Num r, Ord r, Foldable1 (Vector d), Zip (Vector d)) => HasIntersectionWith (Point d r) (Box point) Source # 
Instance details

Defined in HGeometry.Box

Methods

intersects :: Point d r -> Box point -> Bool Source #

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

Defined in HGeometry.Box

Methods

intersect :: LinePV 2 r -> Rectangle point -> Intersection (LinePV 2 r) (Rectangle point) Source #

(Point_ point d r, Num r, Ord r, Foldable1 (Vector d), Zip (Vector d)) => IsIntersectableWith (Point d r) (Box point) Source # 
Instance details

Defined in HGeometry.Box

Methods

intersect :: Point d r -> Box point -> Intersection (Point d r) (Box point) Source #

type Rep (Box point) Source # 
Instance details

Defined in HGeometry.Box.Internal

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

Defined in HGeometry.Box.Internal

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

Defined in HGeometry.Box.Internal

type NumType (Box point) = NumType point
type Intersection (Box point) (Box point) Source # 
Instance details

Defined in HGeometry.Box.Intersection

type Intersection (Box point) (Box point) = Maybe (Box (Point (Dimension point) (NumType point)))
type Intersection (HalfLine point) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

type Intersection (VerticalOrLineEQ r) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

type Intersection (LineEQ r) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

type Intersection (LinePV 2 r) (Rectangle point) Source # 
Instance details

Defined in HGeometry.Box

type Intersection (Point d r) (Box point) Source # 
Instance details

Defined in HGeometry.Box

type Intersection (Point d r) (Box point) = Maybe (Point d r)

type Rectangle = Box Source #

Defines a rectangle

corners :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> Corners point Source #

Get the corners of a rectangle, the order is:

Any additional information from in the top points is taken from the Top point, Any additional information from in the bottom points is taken from the Bottom point,

cornersInDirection :: CardinalDirection -> Corners p -> Vector 2 p Source #

Gets the corners in a particular direction

northEast :: forall a f. Functor f => (a -> f a) -> Corners a -> f (Corners a) Source #

Access the northeast corner

northWest :: forall a f. Functor f => (a -> f a) -> Corners a -> f (Corners a) Source #

Access the northwest corner

southEast :: forall a f. Functor f => (a -> f a) -> Corners a -> f (Corners a) Source #

Access the southeast corner

southWest :: forall a f. Functor f => (a -> f a) -> Corners a -> f (Corners a) Source #

Access the southwest corner

data Corners a Source #

A data type rperesenting the corners of a box. the order of the Corners is 'northWest, northEast, southEast, southWest', i.e. in clockwise order starting from the topleft.

Constructors

Corners !a !a !a !a 

Instances

Instances details
Foldable1 Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

fold1 :: Semigroup m => Corners m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Corners a -> m Source #

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

toNonEmpty :: Corners a -> NonEmpty a Source #

maximum :: Ord a => Corners a -> a Source #

minimum :: Ord a => Corners a -> a Source #

head :: Corners a -> a Source #

last :: Corners a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Corners a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Corners a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Corners a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Corners a -> b Source #

Applicative Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

pure :: a -> Corners a Source #

(<*>) :: Corners (a -> b) -> Corners a -> Corners b Source #

liftA2 :: (a -> b -> c) -> Corners a -> Corners b -> Corners c Source #

(*>) :: Corners a -> Corners b -> Corners b Source #

(<*) :: Corners a -> Corners b -> Corners a Source #

Functor Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

fmap :: (a -> b) -> Corners a -> Corners b Source #

(<$) :: a -> Corners b -> Corners a Source #

Foldable Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

fold :: Monoid m => Corners m -> m Source #

foldMap :: Monoid m => (a -> m) -> Corners a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Corners a -> b Source #

foldr' :: (a -> b -> b) -> b -> Corners a -> b Source #

foldl :: (b -> a -> b) -> b -> Corners a -> b Source #

foldl' :: (b -> a -> b) -> b -> Corners a -> b Source #

foldr1 :: (a -> a -> a) -> Corners a -> a Source #

foldl1 :: (a -> a -> a) -> Corners a -> a Source #

toList :: Corners a -> [a] Source #

null :: Corners a -> Bool Source #

length :: Corners a -> Int Source #

elem :: Eq a => a -> Corners a -> Bool Source #

maximum :: Ord a => Corners a -> a Source #

minimum :: Ord a => Corners a -> a Source #

sum :: Num a => Corners a -> a Source #

product :: Num a => Corners a -> a Source #

Traversable Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

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

sequenceA :: Applicative f => Corners (f a) -> f (Corners a) Source #

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

sequence :: Monad m => Corners (m a) -> m (Corners a) Source #

Traversable1 Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

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

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

FoldableWithIndex InterCardinalDirection Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

ifoldMap :: Monoid m => (InterCardinalDirection -> a -> m) -> Corners a -> m Source #

ifoldMap' :: Monoid m => (InterCardinalDirection -> a -> m) -> Corners a -> m Source #

ifoldr :: (InterCardinalDirection -> a -> b -> b) -> b -> Corners a -> b Source #

ifoldl :: (InterCardinalDirection -> b -> a -> b) -> b -> Corners a -> b Source #

ifoldr' :: (InterCardinalDirection -> a -> b -> b) -> b -> Corners a -> b Source #

ifoldl' :: (InterCardinalDirection -> b -> a -> b) -> b -> Corners a -> b Source #

FunctorWithIndex InterCardinalDirection Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

imap :: (InterCardinalDirection -> a -> b) -> Corners a -> Corners b Source #

TraversableWithIndex InterCardinalDirection Corners Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

itraverse :: Applicative f => (InterCardinalDirection -> a -> f b) -> Corners a -> f (Corners b) Source #

Monoid a => Monoid (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Semigroup a => Semigroup (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

(<>) :: Corners a -> Corners a -> Corners a Source #

sconcat :: NonEmpty (Corners a) -> Corners a Source #

stimes :: Integral b => b -> Corners a -> Corners a Source #

Generic (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Associated Types

type Rep (Corners a) 
Instance details

Defined in HGeometry.Box.Corners

type Rep (Corners a) = D1 ('MetaData "Corners" "HGeometry.Box.Corners" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Corners" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_northWest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_northEast") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "_southEast") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_southWest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))

Methods

from :: Corners a -> Rep (Corners a) x Source #

to :: Rep (Corners a) x -> Corners a Source #

Show a => Show (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Eq a => Eq (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

(==) :: Corners a -> Corners a -> Bool Source #

(/=) :: Corners a -> Corners a -> Bool Source #

Ord a => Ord (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Ixed (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

Methods

ix :: Index (Corners a) -> Traversal' (Corners a) (IxValue (Corners a)) Source #

type Rep (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

type Rep (Corners a) = D1 ('MetaData "Corners" "HGeometry.Box.Corners" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Corners" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_northWest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_northEast") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "_southEast") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_southWest") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))
type Index (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

type IxValue (Corners a) Source # 
Instance details

Defined in HGeometry.Box.Corners

type IxValue (Corners a) = a

bottomSide :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> ClosedLineSegment point Source #

Oriented from *left to right*

east :: forall a f. Functor f => (a -> f a) -> Sides a -> f (Sides a) Source #

Access the east side

intersectingHalfPlanes :: (Rectangle_ rectangle point, Point_ point 2 r, Num r) => rectangle -> Sides (HalfSpaceF (LinePV 2 r)) Source #

Gets the four halfplanes so that the box is the intersection of the halfplanes.

leftSide :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> ClosedLineSegment point Source #

Left side of the box, from bottom to top

north :: forall a f. Functor f => (a -> f a) -> Sides a -> f (Sides a) Source #

Access the north side

rightSide :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> ClosedLineSegment point Source #

The right side, oriented from *bottom* to top

sideDirections :: Sides CardinalDirection Source #

Constructs a Sides value that indicates the appropriate direction.

sideValues :: (Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> Sides r Source #

The side values of the rectangle, i.e. the coordinates of the top, right, bottom, and left sides.

sides :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> Sides (ClosedLineSegment point) Source #

The sides of the rectangle, in order (Top, Right, Bottom, Left). The sides themselves are also oriented in clockwise order. If, you want them in the same order as the functions topSide, bottomSide, leftSide, and rightSide, use sides' instead.

sides' :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> Sides (ClosedLineSegment point) Source #

The sides of the rectangle. The order of the segments is (Top, Right, Bottom, Left). Note that the segments themselves, are oriented as described by the functions topSide, bottomSide, leftSide, rightSide (basically: from left to right, and from bottom to top). If you want the segments oriented along the boundary of the rectangle, use the sides function instead.

south :: forall a f. Functor f => (a -> f a) -> Sides a -> f (Sides a) Source #

Access the south side

topSide :: (Num r, Rectangle_ rectangle point, Point_ point 2 r) => rectangle -> ClosedLineSegment point Source #

The top side of the box, from left to right.

west :: forall a f. Functor f => (a -> f a) -> Sides a -> f (Sides a) Source #

Access the west side

data Sides a Source #

The four sides of a rectangle

i.e. a `Sides n e s w` rerpesents an object whose north side is n, east side e, south side s, and west side w.

Constructors

Sides !a !a !a !a 

Instances

Instances details
Foldable1 Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

fold1 :: Semigroup m => Sides m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Sides a -> m Source #

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

toNonEmpty :: Sides a -> NonEmpty a Source #

maximum :: Ord a => Sides a -> a Source #

minimum :: Ord a => Sides a -> a Source #

head :: Sides a -> a Source #

last :: Sides a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Sides a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Sides a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Sides a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Sides a -> b Source #

Applicative Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

pure :: a -> Sides a Source #

(<*>) :: Sides (a -> b) -> Sides a -> Sides b Source #

liftA2 :: (a -> b -> c) -> Sides a -> Sides b -> Sides c Source #

(*>) :: Sides a -> Sides b -> Sides b Source #

(<*) :: Sides a -> Sides b -> Sides a Source #

Functor Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

fmap :: (a -> b) -> Sides a -> Sides b Source #

(<$) :: a -> Sides b -> Sides a Source #

Foldable Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

fold :: Monoid m => Sides m -> m Source #

foldMap :: Monoid m => (a -> m) -> Sides a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Sides a -> b Source #

foldr' :: (a -> b -> b) -> b -> Sides a -> b Source #

foldl :: (b -> a -> b) -> b -> Sides a -> b Source #

foldl' :: (b -> a -> b) -> b -> Sides a -> b Source #

foldr1 :: (a -> a -> a) -> Sides a -> a Source #

foldl1 :: (a -> a -> a) -> Sides a -> a Source #

toList :: Sides a -> [a] Source #

null :: Sides a -> Bool Source #

length :: Sides a -> Int Source #

elem :: Eq a => a -> Sides a -> Bool Source #

maximum :: Ord a => Sides a -> a Source #

minimum :: Ord a => Sides a -> a Source #

sum :: Num a => Sides a -> a Source #

product :: Num a => Sides a -> a Source #

Traversable Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

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

sequenceA :: Applicative f => Sides (f a) -> f (Sides a) Source #

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

sequence :: Monad m => Sides (m a) -> m (Sides a) Source #

Traversable1 Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

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

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

FoldableWithIndex CardinalDirection Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

ifoldMap :: Monoid m => (CardinalDirection -> a -> m) -> Sides a -> m Source #

ifoldMap' :: Monoid m => (CardinalDirection -> a -> m) -> Sides a -> m Source #

ifoldr :: (CardinalDirection -> a -> b -> b) -> b -> Sides a -> b Source #

ifoldl :: (CardinalDirection -> b -> a -> b) -> b -> Sides a -> b Source #

ifoldr' :: (CardinalDirection -> a -> b -> b) -> b -> Sides a -> b Source #

ifoldl' :: (CardinalDirection -> b -> a -> b) -> b -> Sides a -> b Source #

FunctorWithIndex CardinalDirection Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

imap :: (CardinalDirection -> a -> b) -> Sides a -> Sides b Source #

TraversableWithIndex CardinalDirection Sides Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

itraverse :: Applicative f => (CardinalDirection -> a -> f b) -> Sides a -> f (Sides b) Source #

Monoid a => Monoid (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

mempty :: Sides a Source #

mappend :: Sides a -> Sides a -> Sides a Source #

mconcat :: [Sides a] -> Sides a Source #

Semigroup a => Semigroup (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

(<>) :: Sides a -> Sides a -> Sides a Source #

sconcat :: NonEmpty (Sides a) -> Sides a Source #

stimes :: Integral b => b -> Sides a -> Sides a Source #

Generic (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Associated Types

type Rep (Sides a) 
Instance details

Defined in HGeometry.Box.Sides

type Rep (Sides a) = D1 ('MetaData "Sides" "HGeometry.Box.Sides" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Sides" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_north") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_east") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "_south") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_west") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))

Methods

from :: Sides a -> Rep (Sides a) x Source #

to :: Rep (Sides a) x -> Sides a Source #

Read a => Read (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Show a => Show (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Eq a => Eq (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

(==) :: Sides a -> Sides a -> Bool Source #

(/=) :: Sides a -> Sides a -> Bool Source #

Ord a => Ord (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

compare :: Sides a -> Sides a -> Ordering Source #

(<) :: Sides a -> Sides a -> Bool Source #

(<=) :: Sides a -> Sides a -> Bool Source #

(>) :: Sides a -> Sides a -> Bool Source #

(>=) :: Sides a -> Sides a -> Bool Source #

max :: Sides a -> Sides a -> Sides a Source #

min :: Sides a -> Sides a -> Sides a Source #

Ixed (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

Methods

ix :: Index (Sides a) -> Traversal' (Sides a) (IxValue (Sides a)) Source #

type Rep (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

type Rep (Sides a) = D1 ('MetaData "Sides" "HGeometry.Box.Sides" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Sides" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_north") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_east") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :*: (S1 ('MetaSel ('Just "_south") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_west") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))))
type Index (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

type IxValue (Sides a) Source # 
Instance details

Defined in HGeometry.Box.Sides

type IxValue (Sides a) = a

class IsBoxable g where Source #

Types for which we can compute an axis parallel boundingbox

Minimal complete definition

Nothing

Methods

boundingBox :: forall (d :: Nat) r. (d ~ Dimension g, r ~ NumType g, Ord r) => g -> Box (Point d r) Source #

Compute the axis-parallel boundingbox of the given geometry.

default boundingBox :: forall (d :: Nat) r point. (d ~ Dimension g, r ~ NumType g, Ord r, HasPoints' g point, Point_ point d r, Ord (Vector d r)) => g -> Box (Point d r) Source #

Instances

Instances details
(IsBoxable g, Has_ Additive_ d r, d ~ Dimension g, r ~ NumType g) => IsBoxable (NonEmpty g) Source # 
Instance details

Defined in HGeometry.Box.Boxable

Methods

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

(Box_ (Box point) point, Point_ point d r) => IsBoxable (Box point) Source # 
Instance details

Defined in HGeometry.Box.Boxable

Methods

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

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

IsBoxable g => IsBoxable (g :+ extra) Source # 
Instance details

Defined in HGeometry.Box.Boxable

Methods

boundingBox :: forall (d :: Nat) r. (d ~ Dimension (g :+ extra), r ~ NumType (g :+ extra), Ord r) => (g :+ extra) -> Box (Point d r) Source #

(Traversable1 endPoint, Point_ point d r, d ~ Dimension point, r ~ NumType point, Ord r, Ord (Vector d r)) => IsBoxable (LineSegment endPoint point) Source # 
Instance details

Defined in HGeometry.LineSegment.Internal

Methods

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

IsBoxable (Point d r) Source # 
Instance details

Defined in HGeometry.Box.Boxable

Methods

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

data LineBoxIntersection (d :: Nat) r Source #

Data type representing the intersection of a Box and a line

Instances

Instances details
(Show (Point d r), Show (ClosedLineSegment (Point d r))) => Show (LineBoxIntersection d r) Source # 
Instance details

Defined in HGeometry.Box

(Eq (Point d r), Eq (ClosedLineSegment (Point d r))) => Eq (LineBoxIntersection d r) Source # 
Instance details

Defined in HGeometry.Box

data HalfLineBoxIntersection point Source #

Instances

Instances details
Functor HalfLineBoxIntersection Source # 
Instance details

Defined in HGeometry.Box

Generic (HalfLineBoxIntersection point) Source # 
Instance details

Defined in HGeometry.Box

Associated Types

type Rep (HalfLineBoxIntersection point) 
Instance details

Defined in HGeometry.Box

type Rep (HalfLineBoxIntersection point) = D1 ('MetaData "HalfLineBoxIntersection" "HGeometry.Box" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "HalfLine_x_Box_Point" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 point)) :+: C1 ('MetaCons "HalfLine_x_Box_LineSegment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ClosedLineSegment point))))
Read point => Read (HalfLineBoxIntersection point) Source # 
Instance details

Defined in HGeometry.Box

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

Defined in HGeometry.Box

Eq point => Eq (HalfLineBoxIntersection point) Source # 
Instance details

Defined in HGeometry.Box

type Rep (HalfLineBoxIntersection point) Source # 
Instance details

Defined in HGeometry.Box

type Rep (HalfLineBoxIntersection point) = D1 ('MetaData "HalfLineBoxIntersection" "HGeometry.Box" "hgeometry-kernel-1.0.0.0-inplace" 'False) (C1 ('MetaCons "HalfLine_x_Box_Point" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 point)) :+: C1 ('MetaCons "HalfLine_x_Box_LineSegment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ClosedLineSegment point))))

Orphan instances

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

Methods

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

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

Methods

intersects :: HalfLine point -> Rectangle point -> Bool Source #

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

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

Methods

intersects :: LineEQ r -> Rectangle point -> Bool Source #

(Point_ point 2 r, Ord r, Fractional r) => IsIntersectableWith (HalfLine point) (Rectangle point) Source # 
Instance details

Methods

intersect :: HalfLine point -> Rectangle point -> Intersection (HalfLine point) (Rectangle point) Source #

(Fractional r, Ord r, Point_ point 2 r) => IsIntersectableWith (VerticalOrLineEQ r) (Rectangle point) Source # 
Instance details

(Fractional r, Ord r, Point_ point 2 r) => IsIntersectableWith (LineEQ r) (Rectangle point) Source # 
Instance details

Methods

intersect :: LineEQ r -> Rectangle point -> Intersection (LineEQ r) (Rectangle point) Source #

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

Methods

intersects :: LinePV 2 r -> Rectangle point -> Bool Source #

(Ord r, Num r, Point_ point 2 r, Point_ point' 2 r, HasIntersectionWith (LineSegment endPoint point) (ClosedLineSegment point')) => HasIntersectionWith (LineSegment endPoint point) (Boundary (Rectangle point')) Source # 
Instance details

Methods

intersects :: LineSegment endPoint point -> Boundary (Rectangle point') -> Bool Source #

(Ord r, Num r, Point_ point 2 r, Point_ point' 2 r, IxValue (endPoint point) ~ point, EndPoint_ (endPoint point), HasIntersectionWith (LineSegment endPoint point) (ClosedLineSegment point')) => HasIntersectionWith (LineSegment endPoint point) (Rectangle point') Source # 
Instance details

Methods

intersects :: LineSegment endPoint point -> Rectangle point' -> Bool Source #

(Point_ point d r, Num r, Ord r, Foldable1 (Vector d), Zip (Vector d)) => HasIntersectionWith (Point d r) (Box point) Source # 
Instance details

Methods

intersects :: Point d r -> Box point -> Bool Source #

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

Methods

intersect :: LinePV 2 r -> Rectangle point -> Intersection (LinePV 2 r) (Rectangle point) Source #

(Point_ point d r, Num r, Ord r, Foldable1 (Vector d), Zip (Vector d)) => IsIntersectableWith (Point d r) (Box point) Source # 
Instance details

Methods

intersect :: Point d r -> Box point -> Intersection (Point d r) (Box point) Source #