A 2D bounding box often used for determining Object bounding area.
Bounds holds min/max coordinates of bounding box instead of it's position and size.
See also:
Static methods
staticinlinefromPoints(min:Point, max:Point):Bounds
Returns a new Bounds instance from given min/max Points.
staticinlinefromValues(x0:Float, y0:Float, width:Float, height:Float):Bounds
Returns a new Bounds instance from given rectangle.
Parameters:
x | Rectangle horizontal position. |
|---|---|
y | Rectangle vertical position. |
width | Rectangle width. |
height | Rectangle height. |
Constructor
Variables
x:Float
X-axis position of the bounding box top-left corner. Modifying it alters both Bounds.xMin and Bounds.xMax.
y:Float
Y-axis position of the bounding box top-left corner. Modifying it alters both Bounds.yMin and Bounds.yMax.
Methods
inlineaddPos(x:Float, y:Float):Void
Adds the x and y position to the bounding box, expanding min/max when necessary.
inlinedistance(p:Point):Float
Returns the distance betwen the point and the bounds. Or 0 if the point is inside the bounds.
inlinedoIntersect(b:Bounds):Void
Sets the bounding box min/max values to a result of the intersection between this Bounds and the given Bounds b.
See Bounds.intersection to get new instance of Bounds as intersection result.
inlinedoUnion(b:Bounds):Void
Sets this bounding box min/max values to a result of combining this Bounds and the given Bounds b.
Equivalent of Bounds.addBounds.
intersection(b:Bounds):Bounds
Returns a new Bounds instance containing intersection results of this Bounds and the given Bounds b.
inlineisEmpty():Bool
Tests if bounding box is empty.
Bounds are considered empty when either Bounds.xMax is less than or equals to Bounds.xMin or Bounds.yMax is less than or equals to Bounds.yMin.
rotate(angle:Float):Void
Rotates the bounding box around 0,0 point by given angle and sets min/max to the new rotated boundaries.
inlineset(x:Float, y:Float, width:Float, height:Float):Void
Sets the bounding box from the given rectangle.
Parameters:
x | Rectangle top-left corner horizontal position. |
|---|---|
y | Rectangle top-left corner vertical position. |
width | Rectangle width. |
height | Rectangle height. |
