mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-30 15:57:11 +00:00
compute current VMG only if average VMG is not available
This commit is contained in:
1 parent
e4e00fa228
commit
f11c534892
1 file changed
+1
-2
+1
-2
@@ -454,9 +454,8 @@ public abstract class AbstractRankingMetric implements RankingMetric {
|
||||
private Duration getDurationToReach(final Position windwardPositionToReachInWhosCurrentLeg, TimePoint timePoint,
|
||||
final TrackedLegOfCompetitor whosLeg, WindLegTypeAndLegBearingCache cache) {
|
||||
final Duration toEndOfLegOrTo;
|
||||
final Speed currentVMG = whosLeg.getVelocityMadeGood(timePoint, WindPositionMode.EXACT, cache);
|
||||
final Speed averageVMG = whosLeg.getAverageVelocityMadeGood(timePoint, cache);
|
||||
final Speed vmg = Double.isNaN(averageVMG.getKnots()) ? currentVMG : averageVMG;
|
||||
final Speed vmg = Double.isNaN(averageVMG.getKnots()) ? /* default to current VMG */ whosLeg.getVelocityMadeGood(timePoint, WindPositionMode.EXACT, cache) : averageVMG;
|
||||
toEndOfLegOrTo = vmg.getDuration(
|
||||
whosLeg.getTrackedLeg().getWindwardDistance(
|
||||
getTrackedRace().getTrack(whosLeg.getCompetitor()).getEstimatedPosition(timePoint, /* extrapolate */true),
|
||||
|
||||
Reference in new issue
Block a user