Constructor
new AABB(center, radius)
- Source:
Properties:
Name | Type | Description |
---|---|---|
center |
Lore.Vector3f | The center of this axis-aligned bounding box. |
radius |
number | The radius of this axis-aligned bounding box. |
locCode |
number | The location code of this axis-aligned bounding box in the octree. |
left |
number | The distance of the left plane to the world ZY plane. |
right |
number | The distance of the right plane to the world ZY plane. |
back |
number | The distance of the back plane to the world XY plane. |
front |
number | The distance of the front plane to the world XY plane. |
bottom |
number | The distance of the bottom plane to the world XZ plane. |
top |
number | The distance of the top plane to the world XZ plane. |
neighbours |
Array | The neighbours of this axis-aligned bounding box in an an octree. |
min |
Float32Array | An array specifying the minimum corner point (x, y, z) of the axis-aligned bounding box. |
max |
Float32Array | An array specifying the maximum corner point (x, y, z) of the axis-aligned bounding box. |
Parameters:
Name | Type | Description |
---|---|---|
center |
Lore.Vector3f | A radius for this axis-aligned bounding box. |
radius |
number | A radius for this axis-aligned bounding box. |
Methods
(static) clone(original) → {Lore.AABB}
- Source:
Clones an axis-aligned bounding box.
Parameters:
Name | Type | Description |
---|---|---|
original |
Lore.AABB | The axis-aligned bounding box to be cloned. |
Returns:
The cloned axis-aligned bounding box.
- Type
- Lore.AABB
(static) fromPoints(vertices) → {Lore.AABB}
- Source:
Creates a axis-aligned bounding box surrounding a set of vertices.
Parameters:
Name | Type | Description |
---|---|---|
vertices |
Uint32Array | The vertices which will all be inside the axis-aligned bounding box. |
Returns:
An axis-aligned bounding box surrounding the vertices.
- Type
- Lore.AABB
(static) getCorners(aabb) → {Array}
- Source:
Returns an array representing the 8 corners of the axis-aligned bounding box.
Parameters:
Name | Type | Description |
---|---|---|
aabb |
Lore.AABB | An axis-aligned bounding box. |
Returns:
An array containing the 8 corners of the axisa-aligned bunding box. E.g [[x, y, z], [x, y, z], ...]
- Type
- Array
cylinderTest(source, dir, dist, radius) → {boolean}
- Source:
Tests whether or not this axis-aligned bounding box is intersected by a cylinder. CAUTION: If this runs multi-threaded, it might fail.
Parameters:
Name | Type | Description |
---|---|---|
source |
Lore.Vector3f | The source of the ray. |
dir |
Lore.Vector3f | A normalized vector of the direction of the ray. |
dist |
number | The maximum distance from the source that still counts as an intersect (the far property of the Lore.Raycaster object). |
radius |
number | The radius of the cylinder |
Returns:
- Whether or not there is an intersect.
- Type
- boolean
distanceFromCenterToPointSq(x, y, z) → {number}
- Source:
Returns the box that is closest to the point (measured from center).
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x component of the point coordinate. |
y |
number | The y component of the point coordinate. |
z |
number | The z component of the point coordinate. |
Returns:
The square distance of this axis-aligned bounding box to the input point.
- Type
- number
distanceToPointSq(x, y, z) → {number}
- Source:
Returns the square distance of this axis-aligned bounding box to the point supplied as an argument.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x component of the point coordinate. |
y |
number | The y component of the point coordinate. |
z |
number | The z component of the point coordinate. |
Returns:
The square distance of this axis-aligned bounding box to the input point.
- Type
- number
getLocCode() → {number}
- Source:
Gets the location code of this axis-aligned bounding box.
Returns:
The location code.
- Type
- number
rayTest(source, dir, dist) → {boolean}
- Source:
Tests whether or not this axis-aligned bounding box is intersected by a ray.
Parameters:
Name | Type | Description |
---|---|---|
source |
Lore.Vector3f | The source of the ray. |
dir |
Lore.Vector3f | A normalized vector of the direction of the ray. |
dist |
number | The maximum distance from the source that still counts as an intersect (the far property of the Lore.Raycaster object). |
Returns:
- Whether or not there is an intersect.
- Type
- boolean
setLocCode(locCode)
- Source:
Sets the location code of this axis-aligned bounding box.
Parameters:
Name | Type | Description |
---|---|---|
locCode |
number | The location code. |
testAABB(aabb) → {boolean}
- Source:
Tests whether or not this axis-aligned bounding box overlaps or shares an edge or a vertex with another axis-aligned bounding box. This method can also be used to assert whether or not two boxes are neighbours.
Parameters:
Name | Type | Description |
---|---|---|
aabb |
Lore.AABB | The axis-aligned bounding box to test against. |
Returns:
- Whether or not there is an overlap.
- Type
- boolean
updateDimensions()
- Source:
Calculates the distance of the axis-aligned bounding box's planes to the world planes.