AABB

nape.geom.AABB (final class)

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.

Instance Members

@private


nape
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)


nape
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)


nape
x: Float

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

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


nape
y: Float

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

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


nape
width: Float

width of AABB.

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


nape
height: Float

height of AABB.

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


nape
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 Description
AABB The copy of this AABB.

nape
toString(): String

@private

Returns
String

nape
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.

Name Type Default Description
x Float 0 The x coordinate of the top-left corner of the AABB. (default 0)
y Float 0 The y coordinate of the top-left corner of the AABB (default 0)
width Float 0 The width of the AABB. This value may be negative. (default 0)
height Float 0 The height of the AABB. This value may be negative. (default 0)

Private Members

Metadata

Name Parameters
:final -