public function getPosList()
 {
     $out = [];
     switch ($this->axis) {
         case self::X:
             for ($i = 0; $i < $this->height; $i++) {
                 $x = $this->base->getFloorX() + $i;
                 $centre = new Vector3($x, $this->base->getFloorY(), $this->base->getFloorZ());
                 for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
                     for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
                         $v = new Vector3($x, $y, $z);
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $this->base->getLevel();
                         }
                     }
                 }
             }
             break;
         case self::Y:
             for ($i = 0; $i < $this->height; $i++) {
                 $y = $this->base->getFloorY() + $i;
                 $centre = new Vector3($this->base->getFloorX(), $y, $this->base->getFloorZ());
                 for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorX() + $this->radius; $x++) {
                     for ($z = $this->base->getFloorZ() - $this->radius; $z <= $this->base->getFloorZ() + $this->radius; $z++) {
                         $v = new Position($x, $y, $z, $this->base->getLevel());
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $v;
                         }
                     }
                 }
             }
             break;
         case self::Z:
             for ($i = 0; $i < $this->height; $i++) {
                 $z = $this->base->getFloorZ() + $i;
                 $centre = new Vector3($this->base->getFloorX(), $this->base->getFloorY(), $z);
                 for ($x = $this->base->getFloorX() - $this->radius; $x <= $this->base->getFloorY() + $this->radius; $x++) {
                     for ($y = $this->base->getFloorY() - $this->radius; $y <= $this->base->getFloorY() + $this->radius; $y++) {
                         $v = new Position($x, $y, $z, $this->base->getLevel());
                         if ($centre->distance($v) <= $this->radius) {
                             $out[] = $v;
                         }
                     }
                 }
             }
             break;
     }
     return $out;
 }
 public function getLocByBlock(Position $block)
 {
     return $block->getFloorX() . ";" . $block->getFloorY() . ";" . $block->getFloorZ() . ";" . $block->getLevel()->getFolderName();
 }
Exemple #3
0
 public static function encodeLoc(Position $location)
 {
     return $location->getFloorX() . ";" . $location->getFloorY() . ";" . $location->getFloorZ() . ";" . $location->getLevel()->getFolderName();
 }