AC-Vector-2.4.0: Efficient geometric vectors and transformations.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.BoundingBox.B2

Description

This module provides the BBox2 type for 2-dimensional bounding boxes.

Synopsis

Documentation

data BBox2 Source #

A BBox2 is a 2D bounding box (aligned to the coordinate axies).

Constructors

BBox2 

Fields

Instances

Instances details
Show BBox2 Source # 
Instance details

Defined in Data.BoundingBox.B2

Methods

showsPrec :: Int -> BBox2 -> ShowS #

show :: BBox2 -> String #

showList :: [BBox2] -> ShowS #

Eq BBox2 Source # 
Instance details

Defined in Data.BoundingBox.B2

Methods

(==) :: BBox2 -> BBox2 -> Bool #

(/=) :: BBox2 -> BBox2 -> Bool #

rangeX :: BBox2 -> Range Source #

Return the X-range that this bounding box covers.

rangeY :: BBox2 -> Range Source #

Return the Y-range that this bounding box covers.

rangeXY :: Range -> Range -> BBox2 Source #

Given ranges for each coordinate axis, construct a bounding box.

bound_corners :: Vector2 -> Vector2 -> BBox2 Source #

Given a pair of corner points, construct a bounding box. (The points must be from opposite corners, but it doesn't matter which corners nor which order they are given in.)

bound_points :: [Vector2] -> BBox2 Source #

Find the bounds of a list of points. (Throws an exception if the list is empty.)

within_bounds :: Vector2 -> BBox2 -> Bool Source #

Test whether a given 2D vector is inside this bounding box.

min_point :: BBox2 -> Vector2 Source #

Return the minimum values for both coordinates. (In usual 2D space, the bottom-left corner point.)

max_point :: BBox2 -> Vector2 Source #

Return the maximum values for both coordinates. (In usual 2D space, the top-right corner point.)

union :: BBox2 -> BBox2 -> BBox2 Source #

Take the union of two bounding boxes. The result is a new bounding box that contains all the points the original boxes contained, plus any extra space between them.

isect :: BBox2 -> BBox2 -> Maybe BBox2 Source #

Take the intersection of two bounding boxes. If the boxes do not overlap, return Nothing. Otherwise return a new bounding box containing only the points common to both argument boxes.

unions :: [BBox2] -> BBox2 Source #

Efficiently compute the union of a list of bounding boxes.