Class pv.Quadtree
Represents a quadtree: a two-dimensional recursive spatial subdivision. This particular implementation uses square partitions, dividing each square into four equally-sized squares. Each particle exists in a unique node; if multiple particles are in the same position, some particles may be stored on internal nodes rather than leaf nodes.
This quadtree can be used to accelerate various spatial operations, such
as the Barnes-Hut approximation for computing n-body forces, or collision
detection.
Defined in: Quadtree.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.Quadtree(particles)
Constructs a new quadtree for the specified array of particles.
|
Field Attributes | Field Name and Description |
---|---|
The root node of the quadtree.
|
|
The maximum x-coordinate value of all contained particles.
|
|
The minimum x-coordinate value of all contained particles.
|
|
The maximum y-coordinate value of all contained particles.
|
|
The minimum y-coordinate value of all contained particles.
|
Class Detail
pv.Quadtree(particles)
Constructs a new quadtree for the specified array of particles.
- Parameters:
- {pv.Particle} particles
- the linked list of particles.
Field Detail
{pv.Quadtree.Node}
root
The root node of the quadtree.
{number}
xMax
The maximum x-coordinate value of all contained particles.
{number}
xMin
The minimum x-coordinate value of all contained particles.
{number}
yMax
The maximum y-coordinate value of all contained particles.
{number}
yMin
The minimum y-coordinate value of all contained particles.