A VectorBoundingBox2d
is a version of a BoundingBox2d
that contains
vectors instead of points. All functions behave like their BoundingBox2d
counterparts; see the BoundingBox2d
docs and examples for
details.
Geometry.Types.VectorBoundingBox2d units coordinates
singleton : Vector2d units coordinates -> VectorBoundingBox2d units coordinates
Construct a zero-width bounding box containing a single vector.
xy : Quantity.Interval.Interval Basics.Float units -> Quantity.Interval.Interval Basics.Float units -> VectorBoundingBox2d units coordinates
Construct a bounding box from separate X and Y intervals.
fromIntervals : ( Quantity.Interval.Interval Basics.Float units, Quantity.Interval.Interval Basics.Float units ) -> VectorBoundingBox2d units coordinates
Construct a bounding box from a pair of X and Y intervals.
from : Point2d units coordinates -> BoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Given a point and a bounding box, compute the vector bounding box containing all possible vectors from that point to any point in the bounding box.
between : BoundingBox2d units coordinates -> BoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Given two bounding boxes, compute the vector bounding box containing all possible vectors from a point in the first box to a point in the second box.
Functions for building bounding boxes containing several vectors.
hull2 : Vector2d units coordinates -> Vector2d units coordinates -> VectorBoundingBox2d units coordinates
Construct a bounding box containing the two vectors.
hull3 : Vector2d units coordinates -> Vector2d units coordinates -> Vector2d units coordinates -> VectorBoundingBox2d units coordinates
Build a bounding box that contains all three of the given vectors;
VectorBoundingBox2d.hull3 v1 v2 v3
is equivalent to
VectorBoundingBox2d.hull v1 [ v2, v3 ]
but is more efficient.
hull : Vector2d units coordinates -> List (Vector2d units coordinates) -> VectorBoundingBox2d units coordinates
Find the bounding box containing one or more input vectors:
VectorBoundingBox2d.hull v1 [ v2, v3, v4 ]
See also hullN
.
hullN : List (Vector2d units coordinates) -> Maybe (VectorBoundingBox2d units coordinates)
Construct a bounding box containing all N vectors in the given list. If the
list is empty, returns Nothing
. If you know you have at least one point, you
can use hull
instead.
hullOf : (a -> Vector2d units coordinates) -> a -> List a -> VectorBoundingBox2d units coordinates
Like hull
, but lets you work on any kind of item as long as a
vector can be extracted from it.
hullOfN : (a -> Vector2d units coordinates) -> List a -> Maybe (VectorBoundingBox2d units coordinates)
Combination of hullOf
and hullN
.
Functions for combining several bounding boxes into one bounding box that contains all of the input boxes.
aggregate2 : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Build a bounding box that contains both given bounding boxes.
aggregate3 : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Build a bounding box that contains all three of the given bounding boxes;
VectorBoundingBox2d.aggregate3 b1 b2 b3
is equivalent to
VectorBoundingBox2d.aggregate b1 [ b2, b3 ]
but is more efficient.
aggregate : VectorBoundingBox2d units coordinates -> List (VectorBoundingBox2d units coordinates) -> VectorBoundingBox2d units coordinates
Find the bounding box containing one or more input boxes; works much like
hull
. See also aggregateN
.
aggregateN : List (VectorBoundingBox2d units coordinates) -> Maybe (VectorBoundingBox2d units coordinates)
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
instead.
aggregateOf : (a -> VectorBoundingBox2d units coordinates) -> a -> List a -> VectorBoundingBox2d units coordinates
Like aggregate
, but lets you work on any kind of item as
long as a bounding box can be extracted from it.
aggregateOfN : (a -> VectorBoundingBox2d units coordinates) -> List a -> Maybe (VectorBoundingBox2d units coordinates)
Combination of aggregateOf
and aggregateN
.
xInterval : VectorBoundingBox2d units coordinates -> Quantity.Interval.Interval Basics.Float units
Get the range of X values contained by a bounding box.
yInterval : VectorBoundingBox2d units coordinates -> Quantity.Interval.Interval Basics.Float units
Get the range of Y values contained by a bounding box.
intervals : VectorBoundingBox2d units coordinates -> ( Quantity.Interval.Interval Basics.Float units, Quantity.Interval.Interval Basics.Float units )
Convert a bounding box to a pair of X and Y intervals.
length : VectorBoundingBox2d units coordinates -> Quantity.Interval.Interval Basics.Float units
Get the range of lengths of vectors contained in a given bounding box.
contains : Vector2d units coordinates -> VectorBoundingBox2d units coordinates -> Basics.Bool
Check if a bounding box contains a particular point.
isContainedIn : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> Basics.Bool
Test if the second given bounding box is fully contained within the first (is a subset of it).
intersects : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> Basics.Bool
Test if two boxes touch or overlap at all (have any points in common);
VectorBoundingBox2d.intersects firstBox secondBox
is equivalent to
VectorBoundingBox2d.intersection firstBox secondBox
/= Nothing
but is more efficient.
intersection : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> Maybe (VectorBoundingBox2d units coordinates)
Attempt to build a bounding box that contains all vectors 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).
expandBy : Quantity Basics.Float units -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d 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.
interpolate : VectorBoundingBox2d units coordinates -> Basics.Float -> Basics.Float -> Vector2d units coordinates
Interpolate within a bounding box based on parameter values which range from 0 to 1.
at : Quantity Basics.Float (Quantity.Rate units2 units1) -> VectorBoundingBox2d units1 coordinates -> VectorBoundingBox2d units2 coordinates
Convert a bounding box from one units type to another, by providing a conversion factor given as a rate of change of destination units with respect to source units.
at_ : Quantity Basics.Float (Quantity.Rate units1 units2) -> VectorBoundingBox2d units1 coordinates -> VectorBoundingBox2d units2 coordinates
Convert a bounding box from one units type to another, by providing an 'inverse' conversion factor given as a rate of change of source units with respect to destination units.
multiplyBy : Basics.Float -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Multiply (scale) a bounding box by the given value.
divideBy : Basics.Float -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Divide a bounding box by the given value.
half : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Equivalent to multiplyBy 0.5
but shorter and slightly faster.
twice : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Equivalent to multiplyBy 2
but shorter and slightly faster.
plus : Vector2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Add a vector to a bounding box.
plusBoundingBox : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Add two bounding boxes together.
minus : Vector2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Subtract a vector from a bounding box. Note the argument order; to compute
box - vector
you would write
box |> VectorBoundingBox2d.minus vector
which is equivalent to
VectorBoundingBox2d.minus vector box
difference : Vector2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Subtract a bounding box from a vector (the opposite of minus
).
To compute vector - box
you would write
VectorBoundingBox2d.difference vector box
minusBoundingBox : VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Subtract one bounding box from another. Note the argument order; to compute
firstBox - secondBox
you would write
firstBox
|> VectorBoundingBox2d.minusBoundingBox secondBox
which is equivalent to
VectorBoundingBox2d.minusBoundingBox secondBox firstBox
times : Quantity Basics.Float scalarUnits -> VectorBoundingBox2d vectorUnits coordinates -> VectorBoundingBox2d (Quantity.Product vectorUnits scalarUnits) coordinates
Multiply a vector bounding box by a scalar quantity, resulting in a vector
bounding box with units Product vectorUnits scalarUnits
. (To the compiler
Product a b
and Product b a
are different unit types, so sometimes you will
have to swap from product
to times
or vice versa to make the types work
out.)
product : Quantity Basics.Float scalarUnits -> VectorBoundingBox2d vectorUnits coordinates -> VectorBoundingBox2d (Quantity.Product scalarUnits vectorUnits) coordinates
Multiply a scalar quantity and a vector bounding box, resulting in a vector
bounding box with units Product scalarUnits vectorUnits
.
timesUnitless : Quantity Basics.Float Quantity.Unitless -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Multiply a vector bounding box by a unitless quantity, leaving the units unchanged.
timesInterval : Quantity.Interval.Interval Basics.Float scalarUnits -> VectorBoundingBox2d vectorUnits coordinates -> VectorBoundingBox2d (Quantity.Product vectorUnits scalarUnits) coordinates
Multiply a vector bounding box by an interval, resulting in a vector
bounding box with units Product vectorUnits scalarUnits
.
intervalProduct : Quantity.Interval.Interval Basics.Float scalarUnits -> VectorBoundingBox2d vectorUnits coordinates -> VectorBoundingBox2d (Quantity.Product scalarUnits vectorUnits) coordinates
Multiply an interval and a vector bounding box, resulting in a vector
bounding box with units Product scalarUnits vectorUnits
.
timesUnitlessInterval : Quantity.Interval.Interval Basics.Float Quantity.Unitless -> VectorBoundingBox2d units coordinates -> VectorBoundingBox2d units coordinates
Multiply a vector bounding box by a unitless interval, leaving the units unchanged.
randomVector : VectorBoundingBox2d units coordinates -> Random.Generator (Vector2d units coordinates)
Create a random generator for vectors within a given bounding box.