Maintainer | diagrams-discuss@googlegroups.com |
---|---|
Safe Haskell | Safe-Infered |
Definitions and functions for working with bounding boxes.
- data BoundingBox v
- fromCorners :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => Point v -> Point v -> BoundingBox v
- fromPoint :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => Point v -> BoundingBox v
- fromPoints :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [Point v] -> Maybe (BoundingBox v)
- boundingBox :: forall a. (Enveloped a, HasBasis (V a), Ord (Basis (V a))) => a -> BoundingBox (V a)
- getCorners :: BoundingBox v -> (Point v, Point v)
- getAllCorners :: (HasBasis v, AdditiveGroup (Scalar v), Ord (Basis v)) => BoundingBox v -> [Point v]
- boxExtents :: AdditiveGroup v => BoundingBox v -> v
- boxTransform :: (AdditiveGroup v, HasLinearMap v, Fractional (Scalar v), AdditiveGroup (Scalar v), Ord (Basis v)) => BoundingBox v -> BoundingBox v -> Transformation v
- boxFit :: (Enveloped a, Transformable a, Ord (Basis (V a))) => BoundingBox (V a) -> a -> a
- contains :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> Point v -> Bool
- contains' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> Point v -> Bool
- inside :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Bool
- inside' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Bool
- outside :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Bool
- outside' :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Bool
- union :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> BoundingBox v
- intersection :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => BoundingBox v -> BoundingBox v -> Maybe (BoundingBox v)
- unions :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [BoundingBox v] -> Maybe (BoundingBox v)
- intersections :: (HasBasis v, Ord (Basis v), AdditiveGroup (Scalar v), Ord (Scalar v)) => [BoundingBox v] -> Maybe (BoundingBox v)
Bounding boxes
data BoundingBox v Source
A bounding box is an axis-aligned region determined by two points indicating its "lower" and "upper" corners.
Functor BoundingBox | |
Typeable1 BoundingBox | |
Eq v => Eq (BoundingBox v) | |
Data v => Data (BoundingBox v) | |
Read v => Read (BoundingBox v) | |
Show v => Show (BoundingBox v) | |
(InnerSpace v, Floating (Scalar v), Ord (Scalar v), AdditiveGroup (Scalar v), HasBasis v, Ord (Basis v)) => Enveloped (BoundingBox v) | |
VectorSpace v => HasOrigin (BoundingBox v) |
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. (Enveloped 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).
Queries on bounding boxes
getCorners :: BoundingBox v -> (Point v, Point v)Source
Gets the lower and upper corners that define the bounding box.
getAllCorners :: (HasBasis v, AdditiveGroup (Scalar v), Ord (Basis v)) => BoundingBox v -> [Point v]Source
Computes all of the corners of the bounding box.
boxExtents :: AdditiveGroup v => BoundingBox v -> vSource
Get the size of the bounding box - the vector from the lesser to the greater point.
boxTransform :: (AdditiveGroup v, HasLinearMap v, Fractional (Scalar v), AdditiveGroup (Scalar v), Ord (Basis v)) => BoundingBox v -> BoundingBox v -> Transformation vSource
Create a transformation mapping points from one bounding box to the other.
boxFit :: (Enveloped a, Transformable a, Ord (Basis (V a))) => BoundingBox (V a) -> a -> aSource
Transforms a boundable thing to fit within a BoundingBox
.
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).
Operations on bounding boxes
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).