import { DynamicTree } from '@driftengine/physics' ; copy
Constructor
constructor (capacity ?: number)
Parameter Type Description
capacity?number
Properties
Name Type Description
rootnumber
boundsFloat32ArrayminX, minY, minZ, maxX, maxY, maxZ per node.
parentInt32Array
child1Int32Array
child2Int32Array
proxyInt32ArrayThe caller's own id for a leaf; −1 on an internal node.
heightInt32Array
Accessors
Name Type Description
countget numberHow many nodes are in use. A tree of n leaves has 2n − 1 nodes.
Methods
insert (proxyId: number , box: Aabb): number
Parameter Type Description
proxyIdnumber
boxAabb
remove (leaf: number): void
Parameter Type Description
leafnumber
move (leaf: number , box: Aabb): boolean
Re-place a proxy whose tight box has moved. Returns whether the tree changed.
Parameter Type Description
leafnumber
boxAabb
More A move entirely inside the fat box is free: the stored bounds still enclose the proxy, so no
query can miss it. That is the whole point of the margin, and the reason it is a conservative
enlargement rather than a tolerance.
query (box: Aabb , out: Int32Array): number
Fill out with every proxy id whose stored box overlaps box. Returns how many.
Parameter Type Description
boxAabb
outInt32Array