AC-Vector-Fancy-2.4.0: Fancy type-system stuff for AC-Vector

Data.BoundingBox.Fancy

Description

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

Synopsis

# Documentation

class HasSpace b => BoundingBox b whereSource

Class for dealing with bounding boxes.

Methods

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.

union :: b -> b -> bSource

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.

unions :: [b] -> bSource

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

Instances

 BoundingBox BBox4 BoundingBox BBox3 BoundingBox BBox2 BoundingBox BBox1

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.

class HasSpace x => HasBBox x whereSource

Class representing things that possess a bounding box.

Methods

get_bbox :: (BoundingBox b, Point b ~ Point x) => x -> bSource

Get an object's bounding box.