Classes for generically handling bounding boxes, and things that possess bounding boxes.
- class HasSpace b => BoundingBox b where
- class HasSpace x => HasBBox x where
Class for dealing with bounding boxes.
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.)
Given a list of points, construct a bounding box containing them all. (Throws an exception if the list is empty.)
Return a point containing the minimum values for all coordinates.
Return a point containing the maximum values for all coordinates.
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.
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.