Skip to content

Documentation / scene / AABBTree

Class: AABBTree

Defined in: libs/scene/src/utility/aabbtree.ts:25

Axis-Aligned Bounding Box Tree

Constructors

Constructor

new AABBTree(): AABBTree

Defined in: libs/scene/src/utility/aabbtree.ts:31

Creates an empty AABB tree

Returns

AABBTree

Constructor

new AABBTree(rhs): AABBTree

Defined in: libs/scene/src/utility/aabbtree.ts:33

Creates an AABB tree by copying from another AABB tree

Parameters

rhs

AABBTree

Returns

AABBTree

Methods

buildFromPrimitives()

buildFromPrimitives(vertices, indices, primitiveType): void

Defined in: libs/scene/src/utility/aabbtree.ts:64

Build the AABB tree from a polygon soup

Parameters

vertices

number[] | TypedArray

Vertices of the polygon soup

indices

number[] | TypedArray

indices of the polygon soup

primitiveType

PrimitiveType

Prmitive type of the polygon soup

Returns

void


rayIntersectionTest()

rayIntersectionTest(ray): boolean

Defined in: libs/scene/src/utility/aabbtree.ts:92

Checks for intersection between a ray and the AABB tree without calculating the intersection point

Parameters

ray

Ray

The ray being traced

Returns

boolean

true if the ray hits the AABB tree, false otherwise


rayIntersectionDistance()

rayIntersectionDistance(ray): number

Defined in: libs/scene/src/utility/aabbtree.ts:100

Checks for intersection between a ray and the AABB tree

Parameters

ray

Ray

The ray being traced

Returns

number

The distance between the ray origin and the hit point if the ray hits the AABB tree, null otherwise


getTopLevelAABB()

getTopLevelAABB(): AABB

Defined in: libs/scene/src/utility/aabbtree.ts:107

Gets the top level bounding box of the tree

Returns

AABB

The top level bounding box


transform()

transform(matrix): void

Defined in: libs/scene/src/utility/aabbtree.ts:114

Transform the tree by a matrix

Parameters

matrix

Matrix4x4

The transform matrix

Returns

void

Released under the MIT License.