Copyright | (C) 2014 Fumiaki Kinoshita |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Stability | provisional |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The type and accessors for bounding boxes
- data Box f a = Box (f a) (f a)
- isInside :: (Applicative f, Foldable f, Ord a) => f a -> Box f a -> Bool
- inflate :: (Functor f, Num a) => a -> Box f a -> Box f a
- isCanonical :: (Applicative f, Foldable f, Ord a) => Box f a -> Bool
- union :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a
- intersect :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a
- corners :: (Applicative f, Traversable f) => Box f a -> [f a]
- 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)
- size :: (Applicative f, Num a) => f a -> Lens' (Box f a) (f a)
Documentation
The type of bounding box for arbitrary vector f
.
The functions for this type assume that f
is a "zipping" Applicative
.
Box (f a) (f a) |
isInside :: (Applicative f, Foldable f, Ord a) => f a -> Box f a -> Bool Source
check whether the point is in the box.
isCanonical :: (Applicative f, Foldable f, Ord a) => Box f a -> Bool Source
Returns True if the bounding box is valid.
union :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a Source
Calculate an union between two boundingboxes.
intersect :: (Applicative f, Ord a) => Box f a -> Box f a -> Box f a Source
Calculate an intersect between two boundingboxes.
corners :: (Applicative f, Traversable f) => Box f a -> [f a] Source
Enumerate the corners.