src/Misc/Coordinate3D.php
public function distance($target, $y = null, $z = null)
  {
    if($target instanceof self)
    {
      $_x = $this->gps['x'] - $target->gps['x'];
      $_y = $this->gps['y'] - $target->gps['y'];
      $_z = $this->gps['z'] - $target->gps['z'];
    }
    else
    {
      $_x = $this->gps['x'] - $target;
      $_y = $this->gps['y'] - $y;
      $_z = $this->gps['z'] - $z;
    }
    return sqrt($_x*$_x + $_y*$_y + $_z*$_z);
  }
public function distance($target, $y = null, $z = null)
  {
    if($target instanceof self)
    {
      $_x = $this->gps['x'] - $target->gps['x'];
      $_y = $this->gps['y'] - $target->gps['y'];
      $_z = $this->gps['z'] - $target->gps['z'];
    }
    else
    {
      $_x = $this->gps['x'] - $target;
      $_y = $this->gps['y'] - $y;
      $_z = $this->gps['z'] - $z;
    }
    return sqrt($_x*$_x + $_y*$_y + $_z*$_z);
  }
public function distance ( $ target , $ y = null , $ z = null ) { if ( $ target instanceof self ) { $ _x = $ this -> gps [ 'x' ] - $ target -> gps [ 'x' ] ; $ _y = $ this -> gps [ 'y' ] - $ target -> gps [ 'y' ] ; $ _z = $ this -> gps [ 'z' ] - $ target -> gps [ 'z' ] ; } else { $ _x = $ this -> gps [ 'x' ] - $ target ; $ _y = $ this -> gps [ 'y' ] - $ y ; $ _z = $ this -> gps [ 'z' ] - $ z ; } return sqrt ( $ _x * $ _x + $ _y * $ _y + $ _z * $ _z ) ; }
Distance between two coordinates.

@param Coordinate3D|int $target|$x the point to calculate distance to
@param ?int $y the point to calculate distance to
@param ?int $z the point to calculate distance to
@return float distance
Distance between two coordinates .