Exemplo n.º 1
0
 /**
  * Split this QuadTree node into four quadrants for NW/NE/SE/SW
  *
  * @return   null
  **/
 protected function subdivide()
 {
     $width = $this->boundingBox->getWidth() / 2;
     $height = $this->boundingBox->getHeight() / 2;
     $centrePointX = $this->boundingBox->getCentrePoint()->getX();
     $centrePointY = $this->boundingBox->getCentrePoint()->getY();
     $this->northWest = new QuadTree(new QuadTreeBoundingBox(new QuadTreeXYPoint($centrePointX - $width / 2, $centrePointY + $height / 2), $width, $height), $this->maxPoints);
     $this->northEast = new QuadTree(new QuadTreeBoundingBox(new QuadTreeXYPoint($centrePointX + $width / 2, $centrePointY + $height / 2), $width, $height), $this->maxPoints);
     $this->southWest = new QuadTree(new QuadTreeBoundingBox(new QuadTreeXYPoint($centrePointX - $width / 2, $centrePointY - $height / 2), $width, $height), $this->maxPoints);
     $this->southEast = new QuadTree(new QuadTreeBoundingBox(new QuadTreeXYPoint($centrePointX + $width / 2, $centrePointY - $height / 2), $width, $height), $this->maxPoints);
 }