Calculate the distance between to points

@param PointInterface $head First point
@param PointInterface $tail Last point

@return float
174143
protected function distanceBetweenPoints(
        PointInterface $head,
        PointInterface $tail
    ) {
        return sqrt(self::pythagorus($head, $tail));
    }
1031560
private function combineSumPoints($points1, $points2) {
        $pointsCount = count($points1);
        $currPoint = 0;
        foreach ($points2 as $point2) {
            $pointFound = false;
            //leverage the fact that points are sorted and improve O(n^2)
            while ($currPoint < $pointsCount) {
                $point1 = $points1[$currPoint];
                if ($point1['time'] == $point2['time']) {
                    $points1[$currPoint]['sum'] += $point2['sum'];
                    $currPoint++;
                    $pointFound = true;
                    break;
                }
                $currPoint++;
            }
            //point not found in downsampled array, then just append
            if (!$pointFound) {
                $points1[] = $point2;
            }
        }

        return $points1;
    }
1101153
public function lengthSquared() : float
    {
        static $result;

        // Return the cached result if it's available.
        if ($result !== null) {
            return $result;
        }

        // Compute the square sum.
        $sum = 0;

        foreach ($this->components as $component) {
            $sum += $component * $component;
        }

        return $result = $sum;
    }
277603
public function distanceHaversine(Position $from, Position $to): Distance
    {
        $lat1 = \deg2rad($from->latitude());
        $lng1 = \deg2rad($from->longitude());
        $lat2 = \deg2rad($to->latitude());
        $lng2 = \deg2rad($to->longitude());

        $dLat = $lat2 - $lat1;
        $dLon = $lng2 - $lng1;

        $a = \sin($dLat / 2) * \sin($dLat / 2) +
            \cos($lat1) * \cos($lat2) *
            \sin($dLon / 2) * \sin($dLon / 2);

        $c = 2 * \atan2(\sqrt($a), \sqrt(1 - $a));

        return new Distance(Earth::RADIUS * $c);
    }
722692
public function getStopPointPois($externalCoverageId, $stopPointId, $distance = 400)
    {
        $query = array(
            'api' => 'coverage',
            'parameters' => array(
                'region' => $externalCoverageId,
                'action' => 'places_nearby',
                'path_filter' => 'stop_points/'.$stopPointId,
                'parameters' => array(
                    'type' => array('poi'),
                    'filter' => 'poi_type.id=poi_type:Pointsdevente',
                    'distance' => $distance,
                    'count' => 2,
                ),
            ),
        );

        return $this->navitia_component->call($query);
    }
754440
def endpoint(distance, heading)
      d = (distance / 1000.0) / EARTH_RADIUS_KM;
      heading = deg2rad(heading);

      oX = lng * Math::PI / 180;
      oY = lat * Math::PI / 180;

      y = Math.asin(Math.sin(oY) * Math.cos(d) + Math.cos(oY) * Math.sin(d) * Math.cos(heading));
      x = oX + Math.atan2(Math.sin(heading) * Math.sin(d) * Math.cos(oY), Math.cos(d) - Math.sin(oY) * Math.sin(y));

      y = y * 180 / Math::PI;
      x = x * 180 / Math::PI;

      self.class.new(:lat => y, :lng => x)
    end
917458
public static function calculateDistance($pointX, $pointY) {
		$res = 69.09 * rad2deg(acos(sin(deg2rad($pointX['lat'])) * sin(deg2rad($pointY['lat']))
			+ cos(deg2rad($pointX['lat'])) * cos(deg2rad($pointY['lat'])) * cos(deg2rad($pointX['lng']
			- $pointY['lng']))));
		return $res;
	}
590313
@Pure
	public double distance(Point2D<?, ?> point) {
		assert point != null;
		final GeoLocationPoint p = getGeoPosition();
		if (p != null) {
			return Point2D.getDistancePointPoint(p.getX(), p.getY(), point.getX(), point.getY());
		}
		return Double.NaN;
	}
970682
private function getPositionPoint(BoxInterface $imageSize, BoxInterface $watermarkSize): Point
    {
        return new Point(
            (int) (($imageSize->getWidth() - $watermarkSize->getWidth()) / 2),
            (int) (($imageSize->getHeight() - $watermarkSize->getHeight()) / 2)
        );
    }
4054
public function getRandomPoint(Point $min, Point $max)
    {
        $point = $this->newPoint(array_fill(0, $this->dimension, null));

        for ($n = 0; $n < $this->dimension; ++$n) {
            $point[$n] = random_int($min[$n], $max[$n]);
        }

        return $point;
    }
715869
public function lranges($key, $head, $tail){
		return $this->driver->lrange($key, $head, $tail);
	}
1053771
function(points, firstPoint, lastPoint, tolerance){
                var maxDistance = 0;
                var indexFarthest = 0;
    
                for (var index = firstPoint, distance; index < lastPoint; index++) {
                    distance = perpendicularDistance(points[firstPoint], points[lastPoint], points[index]);
                    if (distance > maxDistance) {
                        maxDistance = distance;
                        indexFarthest = index;
                    }
                }
    
                if (maxDistance > tolerance && indexFarthest != firstPoint) {
                    //Add the largest point that exceeds the tolerance
                    pointIndexsToKeep.push(indexFarthest);
                    douglasPeuckerReduction(points, firstPoint, indexFarthest, tolerance);
                    douglasPeuckerReduction(points, indexFarthest, lastPoint, tolerance);
                }
            }
398822
def points_distance(x1, y1, x2, y2)
      Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
    end
611379
public static double distanceSquared(double[] pointA, double[] pointB,
			int offsetB) {
		assert (pointA.length == pointB.length + offsetB);
		double distance = 0.0;
		for (int i = 0; i < pointA.length; i++) {
			double d = pointA[i] - pointB[i + offsetB];
			distance += d * d;
		}
		return distance;
	}
127479
private float distance(MotionEvent event) {
        if (event.getPointerCount() < 2) {
            return 0;
        }
        return PointF.length(event.getX(POINTER1) - event.getX(POINTER2), //
                event.getY(POINTER1) - event.getY(POINTER2));
    }
250043
public function distance(array $a, array $b): float
    {
        if (count($a) !== count($b)) {
            throw InvalidArgumentException::arraySizeNotMatch();
        }

        $differences = [];
        $count = count($a);

        for ($i = 0; $i < $count; ++$i) {
            $differences[] = abs($a[$i] - $b[$i]);
        }

        return max($differences);
    }
348460
public function getDistanceWith(self $point, $precise = true)
    {
        $distance = 0;
        for ($n = 0; $n < $this->dimension; ++$n) {
            $difference = $this->coordinates[$n] - $point->coordinates[$n];
            $distance += $difference * $difference;
        }

        return $precise ? sqrt((float) $distance) : $distance;
    }