Data.BoundingBox
 Contents Class Types 1 dimension 2 dimensions 3 dimensions 4 dimensions
Description
Bounding boxes of various numbers of dimensions, plus a class for generically handling them.
Synopsis
class BoundingBox b where
 type Point b :: * bounds :: Point b -> Point b -> b min_bound :: b -> Point b max_bound :: b -> Point b within_bounds :: Point b -> b -> Bool union :: b -> b -> b isect :: b -> b -> Maybe b
data Range
data BBox1
data BBox2
data BBox3
data BBox4
Class
 class BoundingBox b where Source
Class for dealing with bounding boxes.
Associated Types
 type Point b :: * Source
 The type of vectors that this bounding box deals with.
Methods
 bounds :: Point b -> Point b -> b Source
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.)
 min_bound :: b -> Point b Source
Return a point containing the minimum values for all coordinates.
 max_bound :: b -> Point b Source
Return a point containing the maximum values for all coordinates.
 within_bounds :: Point b -> b -> Bool Source
Test whether a given point lies within a given bounding box.
 union :: b -> b -> b Source
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 b Source
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.
Instances
 BoundingBox BBox4 BoundingBox BBox3 BoundingBox BBox2 BoundingBox BBox1 BoundingBox Range
Types
1 dimension
 data Range Source
A Range represents a continuous interval between two Scalar endpoints.
Instances
 Eq Range Show Range BoundingBox Range
 data BBox1 Source
The BBox1 type is basically a Range, but all the operations over it work with Vector1 (which is really Scalar). While it's called a bounding box, a 1-dimensional box is in truth a simple line interval, just like Range.
Instances
 Eq BBox1 Show BBox1 BoundingBox BBox1
2 dimensions
 data BBox2 Source
A BBox2 is a 2D bounding box (aligned to the coordinate axies).
Instances
 Eq BBox2 Show BBox2 BoundingBox BBox2
3 dimensions
 data BBox3 Source
A BBox3 is a 3D bounding box (aligned to the coordinate axies).
Instances
 Eq BBox3 Show BBox3 BoundingBox BBox3
4 dimensions
 data BBox4 Source
A BBox4 is a 4D bounding box (aligned to the coordinate axies).
Instances
 Eq BBox4 Show BBox4 BoundingBox BBox4