Skip to main content

AABB2

Classes

AABB2

Axis-Aligned Bounding Box in 2D

Functions

computeLineBetweenTwoBoxes(b0, b1, p0, p1)boolean

AABB2

Axis-Aligned Bounding Box in 2D

Kind: global class

new AABB2([x0], [y0], [x1], [y1])

ParamTypeDefault
[x0]Number0
[y0]Number0
[x1]Number0
[y1]Number0

aabB2.x0 : Number

Kind: instance property of AABB2

aabB2.y0 : Number

Kind: instance property of AABB2

aabB2.x1 : Number

Kind: instance property of AABB2

aabB2.y1 : Number

Kind: instance property of AABB2

aabB2.centerX ⇒ number

midpoint along X axis

Kind: instance property of AABB2

aabB2.centerY ⇒ number

midpoint along Y axis

Kind: instance property of AABB2

aabB2.width ⇒ number

Kind: instance property of AABB2

aabB2.height ⇒ number

Kind: instance property of AABB2

aabB2.growWidth(size)

Kind: instance method of AABB2

ParamType
sizenumber

aabB2.growHeight(size)

Kind: instance method of AABB2

ParamType
sizenumber

aabB2.grow(size)

Expands box in every direction by a given amount

Kind: instance method of AABB2

ParamType
sizenumber

aabB2.shrink(size)

Shrinks the box in every direction by a given amount

Kind: instance method of AABB2

ParamType
sizenumber

aabB2.applyMatrix3(m)

Kind: instance method of AABB2

ParamType
mArray.<number>

aabB2.multiplyScalar(value)

Kind: instance method of AABB2

ParamType
valuenumber

aabB2.computeOverlap(other, result) ⇒ boolean

Kind: instance method of AABB2
Returns: boolean - true if there is overlap, result is also written. false otherwise

ParamTypeDescription
otherAABB2
resultAABB2Overlapping region will be written here

aabB2.overlapExists(other) ⇒ boolean

Kind: instance method of AABB2

ParamType
otherAABB2

aabB2._expandToFit(x0, y0, x1, y1)

Kind: instance method of AABB2
Access: public

ParamType
x0Number
y0Number
x1Number
y1Number

aabB2._expandToFitPoint(x, y)

Kind: instance method of AABB2

ParamType
xnumber
ynumber

aabB2.lineIntersectionPoint(p0, p1, result) ⇒ boolean

NOTE: only 1 intersection point is produced

Kind: instance method of AABB2

ParamType
p0Vector2
p1Vector2
resultVector2

aabB2.computeNearestPointToPoint(point, result)

Kind: instance method of AABB2

ParamType
pointVector2
resultVector2

aabB2.costForInclusion(other) ⇒ number

Kind: instance method of AABB2

ParamType
otherAABB2

aabB2._costForInclusion(x0, y0, x1, y1) ⇒ number

Kind: instance method of AABB2

ParamType
x0number
y0number
x1number
y1number

aabB2.computeArea() ⇒ number

Kind: instance method of AABB2

aabB2.computeSurfaceArea() ⇒ number

Kind: instance method of AABB2

aabB2.containsPoint(x, y) ⇒ boolean

Kind: instance method of AABB2

ParamType
xnumber
ynumber

aabB2.expandToFit(other)

Kind: instance method of AABB2

ParamType
otherAABB2

aabB2.getCenter([result])

Kind: instance method of AABB2

ParamType
[result]Vector2

aabB2.midX() ⇒ number

Deprecated

retrieve midpoint of AABB along X axis

Kind: instance method of AABB2

aabB2.midY() ⇒ number

Deprecated

retrieve midpoint of AABB along Y axis

Kind: instance method of AABB2

aabB2.getWidth() ⇒ number

Kind: instance method of AABB2

aabB2.getHeight() ⇒ number

Kind: instance method of AABB2

aabB2.set(x0, y0, x1, y1)

Kind: instance method of AABB2

ParamTypeDescription
x0Number
y0Number
x1Number
y1Numberreturns {AABB2} this

aabB2.setPosition(x, y)

Kind: instance method of AABB2

ParamType
xnumber
ynumber

aabB2.move(deltaX, deltaY)

Relative displacement of the AABB by given vector described by {@param deltaX} and {@param deltaY}

Kind: instance method of AABB2

ParamType
deltaXnumber
deltaYnumber

aabB2.clone() ⇒ AABB2

Kind: instance method of AABB2

aabB2.copy(other) ⇒ AABB2

Kind: instance method of AABB2
Returns: AABB2 - this

ParamType
otherAABB2

aabB2.equals(other) ⇒ boolean

Kind: instance method of AABB2

ParamType
otherAABB2

aabB2.clamp(x0, y0, x1, y1)

Clamps AABB to specified region

Kind: instance method of AABB2

ParamType
x0number
y0number
x1number
y1number

aabB2.setBoundsUnordered(x0, y0, x1, y1)

Set bounds without having to maintain constraint that x0 >= x1 and y0 >= y1

Kind: instance method of AABB2

ParamType
x0number
y0number
x1number
y1number

aabB2.setNegativelyInfiniteBounds()

returns {AABB2}

Kind: instance method of AABB2

aabB2.toArray(target, offset) ⇒ Array.<number> | Float32Array

Kind: instance method of AABB2

ParamTypeDefault
targetArray.<number> | Float32Array
offsetnumber0

AABB2.zero : AABB2

Kind: static property of AABB2
Read only: true

AABB2.unit : AABB2

Kind: static property of AABB2
Read only: true

computeLineBetweenTwoBoxes(b0, b1, p0, p1) ⇒ boolean

Kind: global function
Returns: boolean - false if no intersection line found

ParamTypeDescription
b0AABB2
b1AABB2
p0Vector2resulting line segment point
p1Vector2resulting line segment point