src/Quadtree.js
/**
   * Subdivides the Quadtree in four Quadtrees.
   */
Subdivides the Quadtree in four Quadtrees.
Subdivides the Quadtree in four Quadtrees .
split() {
    const nextLevel = this.#level + 1,
          subWidth  = this.#bounds.width / 2,
          subHeight = this.#bounds.height / 2,
          x         = this.#bounds.x,
          y         = this.#bounds.y;
    this.#nodes[0] = new Quadtree(
      new Rect(x + subWidth,y , subWidth, subHeight),
      nextLevel
    );
    this.#nodes[1] = new Quadtree(
      new Rect(x, y, subWidth, subHeight),
      nextLevel
    );
    this.#nodes[2] = new Quadtree(
      new Rect(x, y + subHeight, subWidth, subHeight),
      nextLevel
    );
    this.#nodes[3] = new Quadtree(
      new Rect(x + subWidth, y + subHeight, subWidth, subHeight),
      nextLevel
    );
  }
split ( ) { const nextLevel = this . #level + 1 , subWidth = this . #bounds . width / 2 , subHeight = this . #bounds . height / 2 , x = this . #bounds . x , y = this . #bounds . y ; this . #nodes [ 0 ] = new Quadtree ( new Rect ( x + subWidth , y , subWidth , subHeight ) , nextLevel ) ; this . #nodes [ 1 ] = new Quadtree ( new Rect ( x , y , subWidth , subHeight ) , nextLevel ) ; this . #nodes [ 2 ] = new Quadtree ( new Rect ( x , y + subHeight , subWidth , subHeight ) , nextLevel ) ; this . #nodes [ 3 ] = new Quadtree ( new Rect ( x + subWidth , y + subHeight , subWidth , subHeight ) , nextLevel ) ; }
Subdivides the Quadtree in four Quadtrees.
Subdivides the Quadtree in four Quadtrees .