public function distanceFrom(Coordinate $coordinate, DistanceUnit $unit = null, DistanceFormula $formula = null)
    {
        if (null === $unit) {
            $unit = DistanceUnit::METER();
        }

        if (null === $formula) {
            $formula = DistanceFormula::FLAT();
        }

        $baseThis       = self::getBaseCoordinate($this);
        $baseCoordinate = self::getBaseCoordinate($coordinate);

        $distance = new Distance();
        $distance
            ->setFrom($baseThis)
            ->setTo($baseCoordinate)
            ->in($unit->toNative())
        ;

        $value = \call_user_func(array($distance, $formula->toNative()));

        return new Real($value);
    }
public function distanceFrom(Coordinate $coordinate, DistanceUnit $unit = null, DistanceFormula $formula = null)
    {
        if (null === $unit) {
            $unit = DistanceUnit::METER();
        }

        if (null === $formula) {
            $formula = DistanceFormula::FLAT();
        }

        $baseThis       = self::getBaseCoordinate($this);
        $baseCoordinate = self::getBaseCoordinate($coordinate);

        $distance = new Distance();
        $distance
            ->setFrom($baseThis)
            ->setTo($baseCoordinate)
            ->in($unit->toNative())
        ;

        $value = \call_user_func(array($distance, $formula->toNative()));

        return new Real($value);
    }
public function distanceFrom ( Coordinate $ coordinate , DistanceUnit $ unit = null , DistanceFormula $ formula = null ) { if ( null === $ unit ) { $ unit = DistanceUnit :: METER ( ) ; } if ( null === $ formula ) { $ formula = DistanceFormula :: FLAT ( ) ; } $ baseThis = self :: getBaseCoordinate ( $ this ) ; $ baseCoordinate = self :: getBaseCoordinate ( $ coordinate ) ; $ distance = new Distance ( ) ; $ distance -> setFrom ( $ baseThis ) -> setTo ( $ baseCoordinate ) -> in ( $ unit -> toNative ( ) ) ; $ value = \ call_user_func ( array ( $ distance , $ formula -> toNative ( ) ) ) ; return new Real ( $ value ) ; }
Calculates the distance between two Coordinate objects

@param  Coordinate      $coordinate
@param  DistanceUnit    $unit
@param  DistanceFormula $formula
@return Real
Calculates the distance between two Coordinate objects