Classes for generically handling bounding boxes, and things that possess bounding boxes.

- class HasSpace b => BoundingBox b where
- axis_range :: (BoundingBox bbox, VectorAxis (Point bbox) axis) => axis -> bbox -> Range
- class HasSpace x => HasBBox x where
- get_bbox :: (BoundingBox b, Point b ~ Point x) => x -> b

# Documentation

class HasSpace b => BoundingBox b whereSource

Class for dealing with bounding boxes.

bound_corners :: Point b -> Point b -> bSource

Given two corner points, construct a bounding box containing them both. (You can use any two points, given in any order, provided that they are from *opposite* corners.)

bound_points :: [Point b] -> bSource

Given a list of points, construct a bounding box containing them all. (Throws an exception if the list is empty.)

min_point :: b -> Point bSource

Return a point containing the minimum values for all coordinates.

max_point :: b -> Point bSource

Return a point containing the maximum values for all coordinates.

within_bounds :: Point b -> b -> BoolSource

Test whether a given point lies within a given bounding box.

Take the union of two bounding boxes. The result is a new bounding box that contains every point that the original pair of boxes contained, and probably some extra space as well.

isect :: b -> b -> Maybe bSource

Take the intersection of two bounding boxes. If the boxes do not overlap, return `Nothing`

. Otherwise return a bounding box containing only the points common to both original bounding boxes.

Take the union of a list of bounding boxes. (This is more efficient than `foldr1 union`

.)

axis_range :: (BoundingBox bbox, VectorAxis (Point bbox) axis) => axis -> bbox -> RangeSource

Get a `Range`

representing the extent of a bounding box on a specified coordinate axis.