boundingboxes-0.2.3: A generic boundingbox for an arbitrary vector

Data.BoundingBox

Description

The type and accessors for bounding boxes

Synopsis

# Documentation

data Box f a Source

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) Functor f => Functor (Box f) Applicative f => Applicative (Box f) Foldable f => Foldable (Box f) Traversable f => Traversable (Box f) Eq (f a) => Eq (Box f a) Ord (f a) => Ord (Box f a) Read (f a) => Read (Box f a) Show (f a) => Show (Box f a)

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

check whether the point is in the box.

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

Extend each side.

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.

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

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

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) Source

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