Function or value | Description |
Full Usage:
aggregate first rest
Parameters:
BoundingBox2D<'Units, 'Coordinates>
rest : BoundingBox2D<'Units, 'Coordinates> list
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Find the bounding box containing one or more input boxes; works much like [`hull`](#hull). See also [`aggregateN`](#aggregateN).
|
Full Usage:
aggregate3 b1 b2 b3
Parameters:
BoundingBox2D<'Units, 'Coordinates>
b2 : BoundingBox2D<'Units, 'Coordinates>
b3 : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Build a bounding box that contains all three of the given bounding boxes. This is equivalent to running `aggregate` with three points but is more efficient.
|
Full Usage:
aggregateN boxes
Parameters:
BoundingBox2D<'Units, 'Coordinates> list
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a bounding box containing all bounding boxes in the given list. If the list is empty, returns `Nothing`. If you know you have at least one bounding box, you can use [`aggregate`](#aggregate) instead.
|
Full Usage:
aggregateOf getBoundingBox first rest
Parameters:
'a -> BoundingBox2D<'Units, 'Coordinates>
first : 'a
rest : 'a list
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Like [`aggregate`](#aggregate), but lets you work on any kind of item as long as a bounding box can be extracted from it.
|
Full Usage:
aggregateOfN getBoundingBox items
Parameters:
'a -> BoundingBox2D<'Units, 'Coordinates>
items : 'a list
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
|
Full Usage:
centerPoint box
Parameters:
BoundingBox2D<'Units, 'Coordiantes>
Returns: Point2D<'Units, 'Coordinates>
|
|
Full Usage:
containingPoint point box
Parameters:
Point2D<'Units, 'Coordinates>
box : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Get a bounding box that contains the new point. If the box does not contain the new point, the box will grow to fit the new point. If the point is within the box, the same bounding box is returned.
|
Full Usage:
containingPoints points box
Parameters:
Point2D<'Units, 'Coordinates> list
box : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
contains target box
Parameters:
Point2D<'Units, 'Coordinates>
box : BoundingBox2D<'Units, 'Coordinates>
Returns: bool
|
|
Full Usage:
corners box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Point2D<'Units, 'Coordinates> list
|
|
Full Usage:
dimensions boundingBox
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units> * Quantity<'Units>
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Creates an infinitely small bounding box. This can be used when growing a bounding box around objects
|
Full Usage:
expandBy amount boundingBox
Parameters:
Quantity<'Units>
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Expand the given bounding box in all directions by the given offset: Negative offsets will be treated as positive (the absolute value will be used), so the resulting box will always be at least as large as the original. If you need to be able to contract a bounding box, use [`offsetBy`](BoundingBox2d#offsetBy) instead.
|
|
|
Full Usage:
fromExtrema given
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() If the minimum and maximum values are provided in the wrong order (for example if `minX` is greater than `maxX`), then they will be swapped so that the resulting bounding box is valid.
|
Full Usage:
height box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Find the bounding box containing one or more input points. Often ends up being used within a match expression. See also [`hullN`](#hullN).
|
Full Usage:
hull3 firstPoint secondPoint thirdPoint
Parameters:
Point2D<'Units, 'Coordiantes>
secondPoint : Point2D<'Units, 'Coordinates>
thirdPoint : Point2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Build a bounding box that contains all three of the given points. This is equivalent to calling `hull` on three points but is more efficient.
|
Full Usage:
hullN points
Parameters:
Point2D<'Units, 'Coordinates> list
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a bounding box containing all _N_ points in the given list. If the list is empty, returns `Nothing`. If you know you have at least one point, you can use [`hull`](#hull) instead.
|
Full Usage:
hullOf getPoint first rest
Parameters:
'a -> Point2D<'Units, 'Coordinates>
first : 'a
rest : 'a list
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Like [`hull`](#hull), but lets you work on any kind of item as long as a point can be extracted from it. For example, if you had
|
Full Usage:
hullOfN getBoundingBox items
Parameters:
'a -> Point2D<'Units, 'Coordinates>
items : 'a list
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
|
Full Usage:
intersection first second
Parameters:
BoundingBox2D<'Units, 'Coordinates>
second : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
![]() ![]() ![]() ![]() ![]() ![]() Attempt to build a bounding box that contains all points common to both given bounding boxes. If the given boxes do not intersect, returns `Nothing`. If two boxes just touch along an edge or at a corner, they are still considered to have an intersection, even though that intersection will have zero area (at least one of its dimensions will be zero).
|
Full Usage:
intersects first second
Parameters:
BoundingBox2D<'Units, 'Coordinates>
second : BoundingBox2D<'Units, 'Coordinates>
Returns: bool
|
|
Full Usage:
isContainedIn target box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
box : BoundingBox2D<'Units, 'Coordinates>
Returns: bool
|
|
Full Usage:
lineSegments box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: LineSegment2D<'Units, 'Coordinates> list
|
![]() ![]() ![]() ![]() ![]() ![]() Get the four line segments surrounding the bounding box. The lines are created from the top left point, creating line segments around the bounding box clockwise.
|
Full Usage:
maxX box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
Full Usage:
maxY box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
Full Usage:
midX box
Parameters:
BoundingBox2D<'Units, 'Coordiantes>
Returns: Quantity<'Units>
|
|
Full Usage:
midY box
Parameters:
BoundingBox2D<'Units, 'Coordiantes>
Returns: Quantity<'Units>
|
|
Full Usage:
minX box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
Full Usage:
minY box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
Full Usage:
offsetBy amount boundingBox
Parameters:
Quantity<'Units>
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates> option
|
![]() ![]() ![]() ![]() ![]() ![]() Expand or shrink the given bounding box in all the directions by the given distance. A positive offset will cause the bounding box to expand and a negative value will cause it to shrink. Returns `None` if the offset is negative and large enough to cause the bounding box to vanish (that is, if the offset is larger than half the height or half the width of the bounding box, whichever is less). If you only want to expand a bounding box, you can use [`expandBy`](BoundingBox2d#expandBy) instead (which does not return an `Option`).
|
Full Usage:
overlappingByAtLeast tolerance firstBox secondBox
Parameters:
Quantity<'Units>
firstBox : BoundingBox2D<'Units, 'Coordinates>
secondBox : BoundingBox2D<'Units, 'Coordinates>
Returns: bool
|
![]() ![]() ![]() ![]() ![]() ![]() Check two boxes overlap by at least the given amount. For example, you could implement a tolerant collision check (one that only returns true if the boxes overlap by at least a millimeter, and ignores boxes that just barely touch each other). Overlap is defined as the _minimum_ distance one box would have to move so that it did not touch the other. Boxes that just touch are considered to have an overlap of zero.
|
Full Usage:
scaleAbout point scale boundingBox
Parameters:
Point2D<'Units, 'Coordinates>
scale : float
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
separatedByAtLeast tolerance firstBox secondBox
Parameters:
Quantity<'Units>
firstBox : BoundingBox2D<'Units, 'Coordinates>
secondBox : BoundingBox2D<'Units, 'Coordinates>
Returns: bool
|
![]() ![]() ![]() ![]() ![]() ![]() Check if two boxes are separated by at least the given amount. For example, to perform clash detection between some objects, you could use `separatedBy` on those objects' bounding boxes as a quick check to see if the objects had a gap of at least 1 cm between them. Separation is defined as the _minimum_ distance one box would have to move so that it touched the other. (Note that this may be a _diagonal_ distance between corners.) Boxes that just touch are considered to have a separation of zero. will return true even if the two boxes just touch each other.
|
Full Usage:
singleton p
Parameters:
Point2D<'Units, 'Coordinastes>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
translateBy displacement boundingBox
Parameters:
Vector2D<'Units, 'Coordinates>
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
translateIn direction distance boundingBox
Parameters:
Direction2D<'Coordinates>
distance : Quantity<'Units>
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
union first second
Parameters:
BoundingBox2D<'Units, 'Coordinates>
second : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
unsafeOffsetBy amount boundingBox
Parameters:
Quantity<'Units>
boundingBox : BoundingBox2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|
Full Usage:
width box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Quantity<'Units>
|
|
Full Usage:
withDimensions (givenWidth, givenHeight) givenCenterPoint
Parameters:
Quantity<'Units>
givenHeight : Quantity<'Units>
givenCenterPoint : Point2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
|