pocketmine\math\Vector3::distanceSquared PHP Метод

distanceSquared() публичный Метод

public distanceSquared ( Vector3 $pos )
$pos Vector3
    public function distanceSquared(Vector3 $pos)
    {
        return pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2);
    }

Usage Example

Пример #1
0
 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;
 }
All Usage Examples Of pocketmine\math\Vector3::distanceSquared