Skip to main content

Class: AABBNode

physics/aabb/aabbNode.AABBNode

Constructors

constructor

โ€ข new AABBNode(aabb)

Create a AABBNode from a AABB.

Parameters

NameTypeDescription
aabbAABBThe node's AABB

Defined in

src/physics/aabb/aabbNode.ts:22

โ€ข new AABBNode(left, right, margin)

Create a AABBNode from left and right child nodes.

Parameters

NameTypeDescription
leftAABBNodeThe node's left child
rightAABBNodeThe node's right child
marginnumberThe margin to use when creating the fat AABB

Defined in

src/physics/aabb/aabbNode.ts:31

Properties

aabb

โ€ข aabb: AABB

An AABB containing the node's children, if the node has no children then this AABB contains the CollisionObject.

Defined in

src/physics/aabb/aabbNode.ts:7


childrenCrossed

โ€ข childrenCrossed: boolean = false

Defined in

src/physics/aabb/aabbNode.ts:15


left

โ€ข left: AABBNode

Defined in

src/physics/aabb/aabbNode.ts:12


parent

โ€ข parent: AABBNode

Defined in

src/physics/aabb/aabbNode.ts:9


โ€ข right: AABBNode

Defined in

src/physics/aabb/aabbNode.ts:13

Methods

isLeaf

โ–ธ isLeaf(): boolean

Determines wether or not this node is a leaf node.

Returns

boolean

Wether or not this node is a leaf node

Defined in

src/physics/aabb/aabbNode.ts:51


replaceChild

โ–ธ replaceChild(oldChild, newChild): void

Replaces one of the node's children with a new node.

Parameters

NameTypeDescription
oldChildAABBNodeThe old child to replace
newChildAABBNodeThe new child

Returns

void

Defined in

src/physics/aabb/aabbNode.ts:79


sibling

โ–ธ sibling(): AABBNode

Gets this node's sibling.

Returns

AABBNode

this node's sibling

Defined in

src/physics/aabb/aabbNode.ts:94


updateAABB

โ–ธ updateAABB(margin): void

Updates the node's AABB.

If the node is a leaf node the AABB is created from the current aabb's obj.

Otherwise the AABB is the union of the node's children's AABBs.

Parameters

NameTypeDescription
marginnumberThe margin to use when creating the fat AABB

Returns

void

Defined in

src/physics/aabb/aabbNode.ts:64