AABB2
Classes
- AABB2
Axis-Aligned Bounding Box in 2D
Functions
AABB2
Axis-Aligned Bounding Box in 2D
Kind: global class
- AABB2
- new AABB2([x0], [y0], [x1], [y1])
- instance
- .x0 :
Number
- .y0 :
Number
- .x1 :
Number
- .y1 :
Number
- .centerX ⇒
number
- .centerY ⇒
number
- .width ⇒
number
- .height ⇒
number
- .growWidth(size)
- .growHeight(size)
- .grow(size)
- .shrink(size)
- .applyMatrix3(m)
- .multiplyScalar(value)
- .computeOverlap(other, result) ⇒
boolean
- .overlapExists(other) ⇒
boolean
- ._expandToFit(x0, y0, x1, y1)
- ._expandToFitPoint(x, y)
- .lineIntersectionPoint(p0, p1, result) ⇒
boolean
- .computeNearestPointToPoint(point, result)
- .costForInclusion(other) ⇒
number
- ._costForInclusion(x0, y0, x1, y1) ⇒
number
- .computeArea() ⇒
number
- .computeSurfaceArea() ⇒
number
- .containsPoint(x, y) ⇒
boolean
- .expandToFit(other)
- .getCenter([result])
.midX() ⇒number
.midY() ⇒number
- .getWidth() ⇒
number
- .getHeight() ⇒
number
- .set(x0, y0, x1, y1)
- .setPosition(x, y)
- .move(deltaX, deltaY)
- .clone() ⇒
AABB2
- .copy(other) ⇒
AABB2
- .equals(other) ⇒
boolean
- .clamp(x0, y0, x1, y1)
- .setBoundsUnordered(x0, y0, x1, y1)
- .setNegativelyInfiniteBounds()
- .toArray(target, offset) ⇒
Array.<number>
|Float32Array
- .x0 :
- static
new AABB2([x0], [y0], [x1], [y1])
Param | Type | Default |
---|---|---|
[x0] | Number | 0 |
[y0] | Number | 0 |
[x1] | Number | 0 |
[y1] | Number | 0 |
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
Param | Type |
---|---|
size | number |
aabB2.growHeight(size)
Kind: instance method of AABB2
Param | Type |
---|---|
size | number |
aabB2.grow(size)
Expands box in every direction by a given amount
Kind: instance method of AABB2
Param | Type |
---|---|
size | number |
aabB2.shrink(size)
Shrinks the box in every direction by a given amount
Kind: instance method of AABB2
Param | Type |
---|---|
size | number |
aabB2.applyMatrix3(m)
Kind: instance method of AABB2
Param | Type |
---|---|
m | Array.<number> |
aabB2.multiplyScalar(value)
Kind: instance method of AABB2
Param | Type |
---|---|
value | number |
aabB2.computeOverlap(other, result) ⇒ boolean
Kind: instance method of AABB2
Returns: boolean
- true if there is overlap, result is also written. false otherwise
Param | Type | Description |
---|---|---|
other | AABB2 | |
result | AABB2 | Overlapping region will be written here |
aabB2.overlapExists(other) ⇒ boolean
Kind: instance method of AABB2
Param | Type |
---|---|
other | AABB2 |
aabB2._expandToFit(x0, y0, x1, y1)
Kind: instance method of AABB2
Access: public
Param | Type |
---|---|
x0 | Number |
y0 | Number |
x1 | Number |
y1 | Number |
aabB2._expandToFitPoint(x, y)
Kind: instance method of AABB2
Param | Type |
---|---|
x | number |
y | number |
aabB2.lineIntersectionPoint(p0, p1, result) ⇒ boolean
NOTE: only 1 intersection point is produced
Kind: instance method of AABB2
Param | Type |
---|---|
p0 | Vector2 |
p1 | Vector2 |
result | Vector2 |
aabB2.computeNearestPointToPoint(point, result)
Kind: instance method of AABB2
Param | Type |
---|---|
point | Vector2 |
result | Vector2 |
aabB2.costForInclusion(other) ⇒ number
Kind: instance method of AABB2
Param | Type |
---|---|
other | AABB2 |
aabB2._costForInclusion(x0, y0, x1, y1) ⇒ number
Kind: instance method of AABB2
Param | Type |
---|---|
x0 | number |
y0 | number |
x1 | number |
y1 | number |
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
Param | Type |
---|---|
x | number |
y | number |
aabB2.expandToFit(other)
Kind: instance method of AABB2
Param | Type |
---|---|
other | AABB2 |
aabB2.getCenter([result])
Kind: instance method of AABB2
Param | Type |
---|---|
[result] | Vector2 |
aabB2.midX() ⇒ number
number
Deprecated
retrieve midpoint of AABB along X axis
Kind: instance method of AABB2
aabB2.midY() ⇒ number
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
Param | Type | Description |
---|---|---|
x0 | Number | |
y0 | Number | |
x1 | Number | |
y1 | Number | returns {AABB2} this |
aabB2.setPosition(x, y)
Kind: instance method of AABB2
Param | Type |
---|---|
x | number |
y | number |
aabB2.move(deltaX, deltaY)
Relative displacement of the AABB by given vector described by {@param deltaX} and {@param deltaY}
Kind: instance method of AABB2
Param | Type |
---|---|
deltaX | number |
deltaY | number |
aabB2.clone() ⇒ AABB2
Kind: instance method of AABB2
aabB2.copy(other) ⇒ AABB2
Kind: instance method of AABB2
Returns: AABB2
- this
Param | Type |
---|---|
other | AABB2 |
aabB2.equals(other) ⇒ boolean
Kind: instance method of AABB2
Param | Type |
---|---|
other | AABB2 |
aabB2.clamp(x0, y0, x1, y1)
Clamps AABB to specified region
Kind: instance method of AABB2
Param | Type |
---|---|
x0 | number |
y0 | number |
x1 | number |
y1 | number |
aabB2.setBoundsUnordered(x0, y0, x1, y1)
Set bounds without having to maintain constraint that x0 >= x1 and y0 >= y1
Kind: instance method of AABB2
Param | Type |
---|---|
x0 | number |
y0 | number |
x1 | number |
y1 | number |
aabB2.setNegativelyInfiniteBounds()
returns {AABB2}
Kind: instance method of AABB2
aabB2.toArray(target, offset) ⇒ Array.<number>
| Float32Array
Kind: instance method of AABB2
Param | Type | Default |
---|---|---|
target | Array.<number> | Float32Array | |
offset | number | 0 |
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
Param | Type | Description |
---|---|---|
b0 | AABB2 | |
b1 | AABB2 | |
p0 | Vector2 | resulting line segment point |
p1 | Vector2 | resulting line segment point |