boundingboxes-0.2.3: A generic boundingbox for an arbitrary vector

Copyright(C) 2014 Fumiaki Kinoshita
LicenseBSD-style (see the file LICENSE)
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.BoundingBox

Description

The type and accessors for bounding boxes

Synopsis

Documentation

data Box f a #

The type of bounding box for arbitrary vector f. The functions for this type assume that f is a "zipping" Applicative.

Constructors

Box (f a) (f a) 

Instances

Monad f => Monad (Box f) # 

Methods

(>>=) :: Box f a -> (a -> Box f b) -> Box f b #

(>>) :: Box f a -> Box f b -> Box f b #

return :: a -> Box f a #

fail :: String -> Box f a #

Functor f => Functor (Box f) # 

Methods

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

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

Applicative f => Applicative (Box f) # 

Methods

pure :: a -> Box f a #

(<*>) :: Box f (a -> b) -> Box f a -> Box f b #

(*>) :: Box f a -> Box f b -> Box f b #

(<*) :: Box f a -> Box f b -> Box f a #

Foldable f => Foldable (Box f) # 

Methods

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

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

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

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

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

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

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

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

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

null :: Box f a -> Bool #

length :: Box f a -> Int #

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

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

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

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

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

Traversable f => Traversable (Box f) # 

Methods

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

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

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

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

Eq (f a) => Eq (Box f a) # 

Methods

(==) :: Box f a -> Box f a -> Bool #

(/=) :: Box f a -> Box f a -> Bool #

Ord (f a) => Ord (Box f a) # 

Methods

compare :: Box f a -> Box f a -> Ordering #

(<) :: Box f a -> Box f a -> Bool #

(<=) :: Box f a -> Box f a -> Bool #

(>) :: Box f a -> Box f a -> Bool #

(>=) :: Box f a -> Box f a -> Bool #

max :: Box f a -> Box f a -> Box f a #

min :: Box f a -> Box f a -> Box f a #

Read (f a) => Read (Box f a) # 

Methods

readsPrec :: Int -> ReadS (Box f a) #

readList :: ReadS [Box f a] #

readPrec :: ReadPrec (Box f a) #

readListPrec :: ReadPrec [Box f a] #

Show (f a) => Show (Box f a) # 

Methods

showsPrec :: Int -> Box f a -> ShowS #

show :: Box f a -> String #

showList :: [Box f a] -> ShowS #

isInside :: (Applicative f, Foldable f, Ord a) => f a -> Box f a -> Bool #

check whether the point is in the box.

inflate :: (Functor f, Num a) => a -> Box f a -> Box f a #

Extend each side.

isCanonical :: (Applicative f, Foldable f, Ord a) => Box f a -> Bool #

Returns True if the bounding box is valid.

union :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a #

Calculate an union between two boundingboxes.

intersect :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a #

Calculate an intersect between two boundingboxes.

corners :: (Applicative f, Traversable f) => Box f a -> [f a] #

Enumerate the corners.

sizePos :: (Applicative f, Num a) => f a -> Iso' (Box f a) (f a, f a) #

position :: (Applicative f, Num a) => f a -> Lens' (Box f a) (f a) #

The accessor for the position on the given reference. Usually the reference point

size :: (Applicative f, Num a) => f a -> Lens' (Box f a) (f a) #

The accessor for the size. A given reference point will be a center of resizing.