Get the speed between this point and another point in km/h.

@param TrackPoint $trackPoint The other point.
@return float
320377
public function speed(TrackPoint $trackPoint): float
    {
        $start = $this->dateTime();
        $end = $trackPoint->dateTime();
        $dateDiff = $start->diff($end);
        $secondsDifference = ($dateDiff->days * 86400) + ($dateDiff->h * 3600) + ($dateDiff->i * 60) + $dateDiff->s;

        if ($secondsDifference === 0) {
            return 0.0;
        }

        $distance = $this->distanceFromPoint($trackPoint);

        return ($distance / $secondsDifference) * 3.6;
    }
1031773
public function update(Metric $metric, MetricPoint $metricPoint)
    {
        $metricPoint = execute(new UpdateMetricPointCommand(
            $metricPoint,
            $metric,
            Binput::get('value'),
            Binput::get('timestamp')
        ));

        return $this->item($metricPoint);
    }
393891
def translate_point(self, point):
        
        mx, my = self.get_center_offset()
        if self._zoom_level == 1.0:
            return point[0] + mx, point[1] + my
        else:
            return int(round((point[0] + mx)) * self._real_ratio_x), int(round((point[1] + my) * self._real_ratio_y))
1011608
public function hit(Endpoint $endpoint, $count = 1)
    {
        $region = $endpoint->getRegion();
        
        $rateLimit = isset($this->limits[get_class($endpoint)]) ? $this->limits[get_class($endpoint)] : $endpoint->getLimit();
        
        $time = array_keys($rateLimit)[0];
        $limit = $rateLimit[$time];
        
        // Get the respective time limit for this region
        $item = $this->get($endpoint, $time);

        // No results found, create new count for the limit
        if (! $item->isHit()) {
            $item->set($count)->expiresAfter($time);
            $this->store->save($item);
            
            return true;
        }

        // Otherwise there is a count saved for region+method,
        // check if the request count can be performed.
        $currentCount = $item->get();
        if ($count + $currentCount > $limit) {
            throw new RateLimitReachedException(
                "Sending {$count} request".($count === 1) ? '' : 's'." is not allowed! ".
                "Rate limit for '{$endpoint->getName()}' ({$region->getName()}) reached. ".
                "Current count: {$currentCount}. Limit: {$limit}/{$time}s."
            );
        }

        // If it can, increase the current limit
        $item->set($currentCount + $count);
        $this->store->save($item);
        
        return true;
    }
116425
public function stop(): float
	{
		$last = end($this->laps);

		$last->stop();

		return $last->getStopTime() - $this->laps[0]->getStartTime();
	}
810540
public static final double speed(WayPoint wp1, WayPoint wp2)
    {
        double lat1 = wp1.getLatitude();
        double lat2 = wp2.getLatitude();
        double lon1 = wp1.getLongitude();
        double lon2 = wp2.getLongitude();
        long time1 = wp1.getTime();
        long time2 = wp2.getTime();
        return speed(time1, lat1, lon1, time2, lat2, lon2);
    }
34291
public function lap(): float
	{
		$last = end($this->laps);

		$time = $last->stop();

		$this->start();

		return $time;
	}
270167
public function getElapsedTime(): float
	{
		$last = end($this->laps);

		return ($last->isRunning() ? microtime(true) : $last->getStopTime()) - $this->laps[0]->getStartTime();
	}
585583
public function getTrackTitle($trackId)
    {
        $tracks = $this->getAllTracks();

        if ($tracks && isset($tracks[$trackId])) {
            return $tracks[$trackId];
        }
    }
450984
private long getSafePts(long pts, int trackIndex) {
        if (mLastPts[trackIndex] >= pts) {
            // Enforce a non-zero minimum spacing
            // between pts
            mLastPts[trackIndex] += 9643;
            return mLastPts[trackIndex];
        }
        mLastPts[trackIndex] = pts;
        return pts;
    }
461443
public function between(LatLong $pointA, LatLong $pointB)
    {
        if (!empty($this->points)) {
            throw new \RuntimeException('The between() method can only be called when it is the first set or co-ordinates.');
        }
        $this->addPoint($pointA);
        $this->addPoint($pointB);
        return $this;
    }
705413
public function getSum($metric, $tags, $endDt = null) {
        if (null == $metric) {
            return 0;
        }
        
        $min = intval(date('i'));
        $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') );       
        $lastHourDt = date("Y-m-d") . "T" . date('H') . ":$minutes:00Z";
  
        $where = [];
        
        if (!isset($endDt)) {
            $endDt = '2100-01-01T00:00:00Z';
        }
        
        if (strtotime($endDt) < strtotime($lastHourDt)) {
           return 0;
        }
        
        $where[] = "time >= '" . $lastHourDt . "' AND time <= '" . $endDt . "'";
        
        foreach ($tags as $key => $val) {
            $where[] = "$key = '" . $val . "'";
        }

        $points = $this->db->getQueryBuilder()
                ->from($metric)
                ->where($where)
                ->sum('value')
                ->getResultSet()
                ->getPoints();
        
        return isset($points[0]) && isset($points[0]["sum"]) ? $points[0]["sum"] : 0;
    }
310460
protected function parseExtensions(\SimpleXMLElement $trackPoint): array
    {
        $return = array();

        if ($trackPoint->HeartRateBpm) {
            $return[] = HR::fromValue((string)$trackPoint->HeartRateBpm->Value);
        }

        return $return;
    }
271079
protected static double calculateReachDistance(LofPoint basePoint, LofPoint targetPoint)
    {
        double distance = MathUtils.distance(basePoint.getDataPoint(), targetPoint.getDataPoint());

        double reachDistance = (double) ComparatorUtils.max(distance, targetPoint.getkDistance(),
                ComparatorUtils.NATURAL_COMPARATOR);
        return reachDistance;
    }
1136358
@Override
    public Long getTrackingPoint() {
        if (underlyingDataBuffer() != this)
            return underlyingDataBuffer() == null ? trackingPoint : underlyingDataBuffer().getTrackingPoint();
        return trackingPoint;
    }
590182
public function distance(Location $otherLocation)
    {
        $theta = $this->longitude - $otherLocation->getLongitude();
        $distance = (sin(deg2rad($this->latitude))
            * sin(deg2rad($otherLocation->getLatitude())))
            + (cos(deg2rad($this->latitude))
            * cos(deg2rad($otherLocation->getLatitude()))
            * cos(deg2rad($theta)));
        $distance = acos($distance);
        $distance = rad2deg($distance);

        return (float) $distance * 60 * 1.1515;
    }
1245309
public function calcWGS84DistanceTo( Coordinate $otherPoint )
   {

      if ( ! $this->isValid() )
      {
         return 0;
      }

      $b1 = $this->Latitude->getDecimalValue();
      $l1 = $this->Longitude->getDecimalValue();
      $b2 = $otherPoint->Latitude->getDecimalValue();
      $l2 = $otherPoint->Longitude->getDecimalValue();

      $F = \round( ( 0.0 + $b1 + $b2 ) / 2.0, 8 );
      $G = \round( ( 0.0 + $b1 - $b2 ) / 2.0, 9 );
      $l = \round( (double) ( ( 0.0 + $l1 - $l2 ) / 2.0 ), 8 );
      $F = (double) ( self::DEG2RAD * $F );
      $G = (double) ( self::DEG2RAD * $G );
      $l = (double) ( self::DEG2RAD * $l );
      $S = \round( (double) ( \pow( \sin( $G ), 2 ) * \pow( \cos( $l ), 2 )
                              + \pow( \cos( $F ), 2 ) * \pow( \sin( $l ), 2 ) ), 9 );
      $C = \round( (double) ( \pow( \cos( $G ), 2 ) * \pow( \cos( $l ), 2 )
                              + \pow( \sin( $F ), 2 ) * \pow( \sin( $l ), 2 ) ), 9 );
      $w = \round( \atan( \sqrt( $S / $C ) ), 12 );
      $D = \round( 2.0 * $w * self::ERADIUS_WGS84, 9 );
      $R = \round( (double) ( \sqrt( $S * $C ) / $w ), 8 );

      $H1  = \round( ( 3.0 * $R - 2.0 ) / ( 2.0 * $C ), 9 );
      $H2  = \round( ( 3.0 * $R + 2.0 ) / ( 2.0 * $S ), 9 );
      $res = $D * ( 2.0 + self::FLATTING_WGS84 * $H1
                          * \pow( \sin( $F ), 2 ) * \pow( \cos( $G ), 2 )
                    - self::FLATTING_WGS84 * $H2
                      * \pow( \cos( $F ), 2 ) * \pow( \sin( $G ), 2 ) );

      return \round( $res, 3 );

   }