An integer-based bounding box.

See also:

Static methods

staticinlinefromPoints(min:IPoint, max:IPoint):IBounds

Returns a new IBounds instance from given min/max IPoints.

staticinlinefromValues(x0:Int, y0:Int, width:Int, height:Int):IBounds

Returns a new IBounds instance from given rectangle.

Parameters:

x

Rectangle horizontal position.

y

Rectangle vertical position.

width

Rectangle width.

height

Rectangle height.

Constructor

inlinenew()

Create new empty IBounds instance.

Variables

height:Int

Height of the bounding box. Equivalent of yMax - yMin.

width:Int

Width of the bounding box. Equivalent of xMax - xMin.

x:Int

X-axis position of the bounding-box top-left corner. Modifying it alters both xMin and xMax.

xMax:Int

X-axis right-most bounds box point.

xMin:Int

X-axis left-most bounding box point.

y:Int

Y-axis position of the bounding-box top-left corner. Modifying it alters both xMin and xMax.

yMax:Int

Y-axis bottom-most bounding box point.

yMin:Int

Y-axis top-most bounding box point.

Methods

inlineaddBounds(b:IBounds):Void

Adds IBounds b to the IBounds, expanding min/max when necessary.

inlineaddPoint(p:IPoint):Void

Adds IPoint p to the IBounds, expanding min/max when necessary.

inlineaddPos(x:Int, y:Int):Void

Adds position x and y to the IBounds, expanding min/max when necessary.

inlineall():Void

Sets bounds to cover maximum area (-2147483648...0x7FFFFFFF).

inlineclone():IBounds

Returns new copy of this IBounds instance.

inlinecontains(p:IPoint):Bool

Tests if IPoint p is inside the IBounds.

inlinedoIntersect(b:IBounds):Void

Sets this IBounds min/max values to a result of intersection between this IBounds and given IBounds b. See intersection to get new instance of IBounds as intersection result.

inlinedoUnion(b:IBounds):Void

Sets this IBounds min/max values to a result of combining this IBounds and given IBounds b. Equivalent of addBounds.

inlineempty():Void

Clears IBounds into an empty state.

inlinegetCenter():IPoint

Returns a new IPoint containing center coordinate of the IBounds.

inlinegetMax():IPoint

Returns a new IPoint containing xMax and yMax.

inlinegetMin():IPoint

Returns a new IPoint containing xMin and yMin.

inlinegetSize():IPoint

Returns a new IPoint containing size of the IBounds.

intersection(b:IBounds):IBounds

Returns new Bounds instance containing intersection results of this IBounds and given IBounds b.

inlineintersects(b:IBounds):Bool

Tests if this IBounds instances intersects given b IBounds.

inlineisEmpty():Bool

Tests if bounding box is empty. IBounds are considered empty when either xMax is less than or equals to xMin or yMax is less than or equals to yMin.

load(b:IBounds):Void

Copies min/max values from given IBounds b to this IBounds.

inlineoffset(dx:Int, dy:Int):Void

Moves entire bounding box by dx,dy.

inlineset(x:Int, y:Int, width:Int, height:Int):Void

Sets bounds from given rectangle.

Parameters:

x

Rectangle horizontal position.

y

Rectangle vertical position.

width

Rectangle width.

height

Rectangle height.

inlinesetMax(p:IPoint):Void

Sets xMax and yMax to values in given IPoint p.

inlinesetMin(p:IPoint):Void

Sets xMin and yMin to values in given IPoint p.

@:value({ scale : 1. })inlinetoBounds(scale:Float = 1.):Bounds

Converts IBounds to regular Bounds scaled by provided scalar scale.

union(b:IBounds):IBounds

Returns new Bounds instance containing union of this IBounds and given IBounds b.