diagrams-lib-0.2: Embedded domain-specific language for declarative graphics

Maintainerdiagrams-discuss@googlegroups.com

Diagrams.BoundingBox

Contents

Description

Definitions and functions for working with bounding boxes.

Synopsis

Bounding boxes

data BoundingBox v Source

A bounding box is an axis-aligned region determined by two points indicating its "lower" and "upper" corners.

Constructing bounding boxes

fromCorners :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => Point v -> Point v -> BoundingBox vSource

Create a bounding box from any two opposite corners.

fromPoint :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => Point v -> BoundingBox vSource

Create a degenerate bounding "box" containing only a single point.

fromPoints :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [Point v] -> Maybe (BoundingBox v)Source

Create the smallest bounding box containing all the given points.

boundingBox :: forall a. (Boundable a, HasBasis (V a), Ord (Basis (V a))) => a -> BoundingBox (V a)Source

Create a bounding box for any boundable object (such as a diagram or path).

Operations on bounding boxes

contains :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> Point v -> BoolSource

Check whether a point is contained in a bounding box (including its edges).

contains' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> Point v -> BoolSource

Check whether a point is strictly contained in a bounding box.

inside :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoolSource

Test whether the first bounding box is contained inside the second.

inside' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoolSource

Test whether the first bounding box is strictly contained inside the second.

outside :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoolSource

Test whether the first bounding box lies outside the second (although they may intersect in their boundaries).

outside' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoolSource

Test whether the first bounding box lies strictly outside the second (they do not intersect at all).

union :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoundingBox vSource

Form the smallest bounding box containing the given two bounding boxes.

intersection :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Maybe (BoundingBox v)Source

Form the largest bounding box contained within this given two bounding boxes, or Nothing if the two bounding boxes do not overlap at all.

unions :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [BoundingBox v] -> Maybe (BoundingBox v)Source

Compute the smallest bounding box containing all the given bounding boxes (or Nothing if the list is empty).

intersections :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [BoundingBox v] -> Maybe (BoundingBox v)Source

Compute the largest bounding box contained in all the given bounding boxes (or Nothing is the list is empty).