From 4aa917e859d299c6e91f16762be612a7857ffe06 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe <luc@orekit.org> Date: Thu, 24 Jul 2014 17:50:00 +0200 Subject: [PATCH] Allow slight overshoot in interpolation. --- .../rugged/utils/SpacecraftToObservedBody.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java b/core/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java index a4ce3045..6a54ed72 100644 --- a/core/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java +++ b/core/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java @@ -44,6 +44,9 @@ public class SpacecraftToObservedBody { /** End of search time span. */ private final AbsoluteDate maxDate; + /** Tolerance in seconds allowed for {@code minDate} and {@code maxDate} overshooting. */ + private final double overshootTolerance; + /** Step to use for inertial frame to body frame transforms cache computations. */ private final double tStep; @@ -80,8 +83,9 @@ public class SpacecraftToObservedBody { throws RuggedException { try { - this.minDate = minDate; - this.maxDate = maxDate; + this.minDate = minDate; + this.maxDate = maxDate; + this.overshootTolerance = overshootTolerance; // safety checks final AbsoluteDate minPVDate = positionsVelocities.get(0).getDate(); @@ -218,10 +222,10 @@ public class SpacecraftToObservedBody { throws RuggedException { // check date range - if (date.compareTo(minDate) < 0) { + if (minDate.durationFrom(date) > overshootTolerance) { throw new RuggedException(RuggedMessages.OUT_OF_TIME_RANGE, date, minDate, maxDate); } - if (date.compareTo(maxDate) > 0) { + if (date.durationFrom(maxDate) > overshootTolerance) { throw new RuggedException(RuggedMessages.OUT_OF_TIME_RANGE, date, minDate, maxDate); } -- GitLab