diff --git a/src/tutorials/java/fr/cs/examples/InverseLocation.java b/src/tutorials/java/fr/cs/examples/InverseLocation.java index 9e630244607853ff6e295a0c02e9494d3a197838..5520bff0e2e028a29586aa0ceb6d9682a5dd556d 100644 --- a/src/tutorials/java/fr/cs/examples/InverseLocation.java +++ b/src/tutorials/java/fr/cs/examples/InverseLocation.java @@ -194,16 +194,19 @@ public class InverseLocation { Frame pvFrame = ruggedBuilder.getInertialFrame(); // Initialize the RoughVisibilityEstimator - RoughVisibilityEstimator roughVisibilityEstimator= new RoughVisibilityEstimator(oneAxisEllipsoid, pvFrame, satellitePVList); + RoughVisibilityEstimator roughVisibilityEstimator = new RoughVisibilityEstimator(oneAxisEllipsoid, pvFrame, satellitePVList); // Compute the approximated line with a rough estimator AbsoluteDate roughLineDate = roughVisibilityEstimator.estimateVisibility(gp); double roughLine = lineSensor.getLine(roughLineDate); // Compute the min / max lines interval using a margin around the roughLine + int sensorMinLine= 0; + int sensorMaxLine = 1000; + int margin = 100; - int minLineRough = (int) FastMath.max(FastMath.floor(roughLine - margin), 0); - int maxLineRough = (int) FastMath.floor(roughLine + margin); + int minLineRough = (int) FastMath.max(roughLine - margin, sensorMinLine); + int maxLineRough = (int) FastMath.min(roughLine + margin, sensorMaxLine); SensorPixel sensorPixelRoughLine = rugged.inverseLocation(sensorName, gp, minLineRough, maxLineRough); System.out.format(Locale.US, "Rough line found = %5.1f; InverseLocation gives (margin of %d around rough line): line = %5.3f, pixel = %5.3f %n", roughLine, margin, sensorPixelRoughLine.getLineNumber(), sensorPixel.getPixelNumber()); diff --git a/src/tutorials/java/fr/cs/exercises/InverseLocationToBeCompleted.java b/src/tutorials/java/fr/cs/exercises/InverseLocationToBeCompleted.java index 52fa86a454becdb2e9bf6b5538348abdf9a9765c..368abed4aa3ffe32a7ce3adbeadbf06a7553ab32 100644 --- a/src/tutorials/java/fr/cs/exercises/InverseLocationToBeCompleted.java +++ b/src/tutorials/java/fr/cs/exercises/InverseLocationToBeCompleted.java @@ -194,7 +194,7 @@ public class InverseLocationToBeCompleted { // ###################################################################### // Initialize the RoughVisibilityEstimator // ###################################################################### - RoughVisibilityEstimator roughVisibilityEstimator= null; + RoughVisibilityEstimator roughVisibilityEstimator = null; // ###################################################################### // Compute the approximated line with a rough estimator @@ -203,9 +203,13 @@ public class InverseLocationToBeCompleted { double roughLine = lineSensor.getLine(roughLineDate); // Compute the min / max lines interval using a margin around the roughLine + int sensorMinLine= 0; + int sensorMaxLine = 1000; + int margin = 100; - int minLineRough = (int) FastMath.max(FastMath.floor(roughLine - margin), 0); - int maxLineRough = (int) FastMath.floor(roughLine + margin); + int minLineRough = (int) FastMath.max(roughLine - margin, sensorMinLine); + int maxLineRough = (int) FastMath.min(roughLine + margin, sensorMaxLine); + SensorPixel sensorPixelRoughLine = rugged.inverseLocation(sensorName, gp, minLineRough, maxLineRough); System.out.format(Locale.US, "Rough line found = %5.1f; InverseLocation gives (margin of %d around rough line): line = %5.3f, pixel = %5.3f %n", roughLine, margin, sensorPixelRoughLine.getLineNumber(), sensorPixel.getPixelNumber());