insert method

bool insert(
  1. QuadTreeParticle particle
)

Inserts a particle into the tree Returns true if insertion was successful

Mathematical Operation:

  • Recursively finds the smallest quadrant that can contain the particle
  • Uses point-in-rectangle test at each level

Implementation

bool insert(QuadTreeParticle particle) {
  return _root.insert(particle);
}