class nape.geom.AABB

Available on all platforms

Axis Aligned Bounding Box (AABB) *

* Note that in many cases of an AABB object being returned by a Nape function * the AABB object will be marked internally as an 'immutable' AABB. This will * always be documented and trying to mutate such an AABB will result in an * error being thrown.

Class Fields

static function fromRect(rect:Rectangle):AABB

Construct an AABB from an AS3 Rectangle object. *

* This method is only available on flash and * openfl||nme targets. * *

rect

The AS3 Rectangle to construct AABB from, this value * must not be null. *

returns

The constructed AABB matching the input Rectangle. *

Instance Fields

var height:Float

height of AABB. *

* This value is and must always be positive. * @default 0

var max:Vec2

The maximum bounds for the AABB. *

* Euivalent to the bottom-right corner. *
* This Vec2 is intrinsically linked to the AABB so that modifications * to this object are reflected in changes to the AABB and vice-versa. *

* If the AABB is immutable, then this Vec2 will also be immutable. *

* This value can be set with the = operator, equivalent to performing * aabb.max.set(value). * @default (0, 0)

var min:Vec2

The minimum bounds for the AABB. *

* Euivalent to the top-left corner. *
* This Vec2 is intrinsically linked to the AABB so that modifications * to this object are reflected in changes to the AABB and vice-versa. *

* If the AABB is immutable, then this Vec2 will also be immutable. *

* This value can be set with the = operator, equivalent to performing * aabb.min.set(value). * @default (0, 0)

var width:Float

width of AABB. *

* This value is and must always be positive. * @default 0

var x:Float

The x coordinate of the AABB's top-left corner. *

* Equivalent to accessing/mutating min.x. * @default 0

var y:Float

The y coordinate of the AABB's top-left corner. *

* Equivalent to accessing/mutating min.y. * @default 0

var zpp_inner:ZPP_AABB

@private

function new(?x:Float = 0, ?y:Float = 0, ?width:Float = 0, ?height:Float = 0):Void

Construct a new AABB. *

* As input width/height are permitted to be negative it is not guaranteed * that the resultant AABB will have the same parameters as those * specified as the AABB parameters are guaranteed to always have positive * width/height, and for x/y to always be the top-left corner. * *

x

The x coordinate of the top-left corner of the AABB. * (default 0) *

y

The y coordinate of the top-left corner of the AABB * (default 0) *

width

The width of the AABB. This value may be negative. * (default 0) *

height

The height of the AABB. This value may be negative. * (default 0) *

returns

The newly constructed AABB object.

function copy():AABB

Produce a copy of this AABB. *

* As would be expected, if you produce a copy of an 'immutable' AABB then * the copy will be 'mutable'. * *

returns

The copy of this AABB.

function toRect():Rectangle

Create an AS3 Rectangle object from AABB. *

* This method is available only on flash and * openfl||nme targets. * *

returns

The AS3 Rectangle object representing AABB.

function toString():String

@private