File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
contrib/src/main/java/gov/nasa/jpl/aerie/contrib/streamline/modeling/polynomial Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -461,15 +461,18 @@ public static ClampedIntegrateResult clampedIntegrate(
461461 }
462462
463463 private static Condition fixedTimeCondition (Optional <Duration > time ) {
464- return time .<Condition >map (time$ -> (positive , atEarliest , atLatest ) -> {
465- if (positive ) {
466- return time .filter (atLatest ::noShorterThan ).map (t -> Duration .max (atEarliest , t ));
467- } else {
468- return Optional .of (atEarliest ).filter (time$ ::longerThan );
469- }
464+ return time .<Condition >map (time$ -> {
465+ var targetTime = Resources .currentTime ().plus (time$ );
466+ return (positive , atEarliest , atLatest ) -> {
467+ var timeRemaining = targetTime .minus (Resources .currentTime ());
468+ if (positive ) {
469+ return Optional .of (timeRemaining ).filter (atLatest ::noShorterThan ).map (t -> Duration .max (atEarliest , t ));
470+ } else {
471+ return Optional .of (atEarliest ).filter (timeRemaining ::longerThan );
472+ }
473+ };
470474 }).orElse (Condition .FALSE );
471475 }
472-
473476 private record ClampedIntegrateInternalResult (
474477 Polynomial integral ,
475478 Polynomial overflow ,
You can’t perform that action at this time.
0 commit comments