public function distanceSquared(Vector3 $pos) { return pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2); }
public function isInside(Vector3 $v) { if (!$this->isValid()) { return false; } if ($v instanceof Position and $v->getLevel()->getName() !== $this->levelName) { return false; } return $v->distanceSquared($this->center) <= $this->radiusSquared; }