Math.Geometry


Bounding Box 2D

Builders

BoundingBox2D.singleton (Point2D.meters 3. 5.)
No value returned by any evaluator
BoundingBox2D.from (Point2D.meters 1. -3.) (Point2D.meters -5. 2.)
No value returned by any evaluator
BoundingBox2D.fromExtrema
    { MinX = Length.meters 2.
      MaxX = Length.meters 4.
      MinY = Length.meters -1.
      MaxY = Length.meters 1. }
No value returned by any evaluator
BoundingBox2D.withDimensions (Length.meters 7., Length.meters 2.) (Point2D.meters -3. 5.)
No value returned by any evaluator

Accessors

let boundingBox: BoundingBox2D<Meters, Cartesian> =
    BoundingBox2D.fromExtrema
        { MinX = Length.meters 2.
          MaxX = Length.meters 4.
          MinY = Length.meters -1.
          MaxY = Length.meters 1. }
boundingBox.MinX = BoundingBox2D.minX boundingBox
boundingBox.MaxX = BoundingBox2D.maxX boundingBox
boundingBox.MinY = BoundingBox2D.minY boundingBox
boundingBox.MaxY = BoundingBox2D.maxY boundingBox
BoundingBox2D.corners boundingBox
No value returned by any evaluator
BoundingBox2D.width boundingBox
No value returned by any evaluator
BoundingBox2D.height boundingBox
No value returned by any evaluator
BoundingBox2D.dimensions boundingBox
No value returned by any evaluator
BoundingBox2D.midX boundingBox
No value returned by any evaluator
BoundingBox2D.midY boundingBox
No value returned by any evaluator
BoundingBox2D.centerPoint boundingBox
No value returned by any evaluator

Modifiers

BoundingBox2D.containingPoint (Point2D.meters 10. 10.) boundingBox
No value returned by any evaluator
BoundingBox2D.containingPoints [ Point2D.meters 10. 10.; Point2D.meters -10. -10. ] boundingBox
No value returned by any evaluator
BoundingBox2D.scaleAbout
BoundingBox2D.translateBy
BoundingBox2D.translateIn
BoundingBox2D.unsafeOffsetBy
BoundingBox2D.offsetBy
BoundingBox2D.expandBy

Queries

BoundingBox2D.lineSegments
BoundingBox2D.hull
BoundingBox2D.hullOf
BoundingBox2D.hull3
BoundingBox2D.hullN
BoundingBox2D.hullOfN
BoundingBox2D.aggregate
BoundingBox2D.aggregateOf
BoundingBox2D.aggregate3

BoundingBox2D.isContainedIn
BoundingBox2D.contains
BoundingBox2D.intersects
BoundingBox2D.intersection
BoundingBox2D.overlappingByAtLeast
BoundingBox2D.separatedByAtLeast
BoundingBox2D.union
namespace Math
namespace Math.Geometry
namespace Math.Units
Multiple items
union case Cartesian.Cartesian: Cartesian

--------------------
type Cartesian = | Cartesian
Multiple items
module BoundingBox2D from Math.Geometry

--------------------
[<Struct>] type BoundingBox2D<'Units,'Coordinates> = { MinX: Quantity<'Units> MaxX: Quantity<'Units> MinY: Quantity<'Units> MaxY: Quantity<'Units> } interface IGeometry<'Coordinates> override Equals : obj:obj -> bool override GetHashCode : unit -> int member BottomLeft : Point2D<'Units,'Coordinates> member BottomRight : Point2D<'Units,'Coordinates> member TopLeft : Point2D<'Units,'Coordinates> member TopRight : Point2D<'Units,'Coordinates>
val singleton : p:Point2D<'Units,'Coordinastes> -> BoundingBox2D<'Units,'Coordinates>
Multiple items
module Point2D from Math.Geometry

--------------------
[<Struct>] type Point2D<'Units,'Coordinates> = { X: Quantity<'Units> Y: Quantity<'Units> } interface IComparable interface IComparable<Point2D<'Units,'Coordinates>> interface IGeometry<'Coordinates> member Comparison : other:Point2D<'Units,'Coordinates> -> int override Equals : obj:obj -> bool + 1 overload override GetHashCode : unit -> int member LessThan : other:Point2D<'Units,'Coordinates> -> bool static member ( * ) : lhs:Point2D<'Units,'Coordinates> * rhs:float -> Point2D<'Units,'Coordinates> + 1 overload static member ( + ) : lhs:Point2D<'Units,'Coordinates> * rhs:Vector2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates> static member ( - ) : lhs:Point2D<'Units,'Coordinates> * rhs:Point2D<'Units,'Coordinates> -> Vector2D<'Units,'Coordinates> + 1 overload ...
val meters : x:float -> y:float -> Point2D<Meters,'Coordinates>
val from : p1:Point2D<'Units,'Coordinates> -> p2:Point2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'c>
<summary> Create a bounding box that contains the two points </summary>
val fromExtrema : given:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> 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. </summary>
Multiple items
module Length from Math.Units
<category>Module: Unit System</category>
<summary> A <c>Length</c> represents a length in meters, feet, centimeters, miles etc. It is stored as a number of meters. </summary>


--------------------
type Length = Quantity<Meters>
<category>Unit System</category>
val meters : m:float -> Length
<category index="2">Metric</category>
val withDimensions : givenWidth:Quantity<'Units> * givenHeight:Quantity<'Units> -> givenCenterPoint:Point2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
val boundingBox : BoundingBox2D<Meters,Cartesian>
Multiple items
union case Meters.Meters: Meters

--------------------
type Meters = | Meters
<category>Unit</category>
BoundingBox2D.MinX: Quantity<Meters>
val minX : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
BoundingBox2D.MaxX: Quantity<Meters>
val maxX : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
BoundingBox2D.MinY: Quantity<Meters>
val minY : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
BoundingBox2D.MaxY: Quantity<Meters>
val maxY : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
val corners : box:BoundingBox2D<'Units,'Coordinates> -> Point2D<'Units,'Coordinates> list
<summary> Returned in clockwise order from top left rotating around clockwise </summary>
val width : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
val height : box:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units>
val dimensions : boundingBox:BoundingBox2D<'Units,'Coordinates> -> Quantity<'Units> * Quantity<'Units>
<summary> Get the X and Y dimensions (width and height) of a bounding box. </summary>
val midX : box:BoundingBox2D<'Units,'Coordiantes> -> Quantity<'Units>
val midY : box:BoundingBox2D<'Units,'Coordiantes> -> Quantity<'Units>
val centerPoint : box:BoundingBox2D<'Units,'Coordiantes> -> Point2D<'Units,'Coordinates>
val containingPoint : point:Point2D<'Units,'Coordinates> -> box:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> 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. </summary>
val containingPoints : points:Point2D<'Units,'Coordinates> list -> box:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
val scaleAbout : point:Point2D<'Units,'Coordinates> -> scale:float -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> Scale a bounding box about a given point by a given scale. </summary>
val translateBy : displacement:Vector2D<'Units,'Coordinates> -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> Translate a bounding box by a given displacement. </summary>
val translateIn : direction:Direction2D<'Coordinates> -> distance:Quantity<'Units> -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> Translate a bounding box in a given direction by a given distance. </summary>
val unsafeOffsetBy : amount:Quantity<'Units> -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> Offsets boundingBox irrespective of the resulting bounding box is valid or not. </summary>
val offsetBy : amount:Quantity<'Units> -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates> option
<summary> 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`). </summary>
val expandBy : amount:Quantity<'Units> -> boundingBox:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> 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. </summary>
val lineSegments : box:BoundingBox2D<'Units,'Coordinates> -> LineSegment2D<'Units,'Coordinates> list
<summary> 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. </summary>
val hull : first:Point2D<'Units,'Coordinates> -> rest:Point2D<'Units,'Coordinates> list -> BoundingBox2D<'Units,'Coordinates>
<summary> Find the bounding box containing one or more input points. Often ends up being used within a match expression. See also [`hullN`](#hullN). </summary>
val hullOf : getPoint:('a -> Point2D<'Units,'Coordinates>) -> first:'a -> rest:'a list -> BoundingBox2D<'Units,'Coordinates>
<summary> 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 </summary>
val hull3 : firstPoint:Point2D<'Units,'Coordiantes> -> secondPoint:Point2D<'Units,'Coordinates> -> thirdPoint:Point2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> 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. </summary>
val hullN : points:Point2D<'Units,'Coordinates> list -> BoundingBox2D<'Units,'Coordinates> option
<summary> 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. </summary>
val hullOfN : getBoundingBox:('a -> Point2D<'Units,'Coordinates>) -> items:'a list -> BoundingBox2D<'Units,'Coordinates> option
<summary> Combination of [`hullOf`](#hullOf) and [`hullN`](#hullN). </summary>
val aggregate : first:BoundingBox2D<'Units,'Coordinates> -> rest:BoundingBox2D<'Units,'Coordinates> list -> BoundingBox2D<'Units,'Coordinates>
<summary> Find the bounding box containing one or more input boxes; works much like [`hull`](#hull). See also [`aggregateN`](#aggregateN). </summary>
val aggregateOf : getBoundingBox:('a -> BoundingBox2D<'Units,'Coordinates>) -> first:'a -> rest:'a list -> BoundingBox2D<'Units,'Coordinates>
<summary> Like [`aggregate`](#aggregate), but lets you work on any kind of item as long as a bounding box can be extracted from it. </summary>
val aggregate3 : b1:BoundingBox2D<'Units,'Coordinates> -> b2:BoundingBox2D<'Units,'Coordinates> -> b3:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> 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. </summary>
val isContainedIn : target:BoundingBox2D<'Units,'Coordinates> -> box:BoundingBox2D<'Units,'Coordinates> -> bool
<summary> Test to see if the target bounding box is contained withing the bounding box </summary>
val contains : target:Point2D<'Units,'Coordinates> -> box:BoundingBox2D<'Units,'Coordinates> -> bool
<summary> Test to see if the target bounding box is contained withing the bounding box </summary>
val intersects : first:BoundingBox2D<'Units,'Coordinates> -> second:BoundingBox2D<'Units,'Coordinates> -> bool
val intersection : first:BoundingBox2D<'Units,'Coordinates> -> second:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates> option
<summary> 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). </summary>
val overlappingByAtLeast : tolerance:Quantity<'Units> -> firstBox:BoundingBox2D<'Units,'Coordinates> -> secondBox:BoundingBox2D<'Units,'Coordinates> -> bool
<summary> 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. </summary>
val separatedByAtLeast : tolerance:Quantity<'Units> -> firstBox:BoundingBox2D<'Units,'Coordinates> -> secondBox:BoundingBox2D<'Units,'Coordinates> -> bool
<summary> 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. </summary>
val union : first:BoundingBox2D<'Units,'Coordinates> -> second:BoundingBox2D<'Units,'Coordinates> -> BoundingBox2D<'Units,'Coordinates>
<summary> Create a bounding box that contains both bounding boxes. </summary>