Class: kdTree
physics/fluid/kdTree.kdTree
Represents a kdTree that contains Particles.
Constructors
constructor
โข new kdTree(particles
)
Creates a kdTree.
Parameters
Name | Type | Description |
---|---|---|
particles | Particle [] | The particles to add to the tree |
Defined in
src/physics/fluid/kdTree.ts:37
Properties
root
โข root: kdNode
Defined in
src/physics/fluid/kdTree.ts:30
Methods
build
โธ build(particles
, depth?
): kdNode
Builds the kdTree.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
particles | Particle [] | undefined | The particles to add to the tree |
depth | number | 0 | - |
Returns
Defined in
src/physics/fluid/kdTree.ts:46
findNeighbours
โธ findNeighbours(particle
, dist
, distSqr
): Particle
[]
Finds all the neighbours of a particle within the given distance.
Parameters
Name | Type | Description |
---|---|---|
particle | Particle | The particle to find neighbours of |
dist | number | The maximum distance a neighbour can be from the particle |
distSqr | number | The maximum distance squared a neighbour can be from the particle |
Returns
Particle
[]
Defined in
src/physics/fluid/kdTree.ts:81
findNeighboursHelper
โธ Private
findNeighboursHelper(particle
, pos
, dist
, distSqr
, node
, depth
, neighbours
): void
Parameters
Name | Type |
---|---|
particle | Particle |
pos | vec2 |
dist | number |
distSqr | number |
node | kdNode |
depth | number |
neighbours | Particle [] |
Returns
void
Defined in
src/physics/fluid/kdTree.ts:88