From 7e601d25b63e32d1694ab2429e4c595d0896ce96 Mon Sep 17 00:00:00 2001
From: Luc Maisonobe <luc@orekit.org>
Date: Tue, 29 Apr 2014 16:07:02 +0200
Subject: [PATCH] Fixed non-bracketing error near start of sensor line.

---
 src/main/java/org/orekit/rugged/api/Rugged.java     | 2 +-
 src/test/java/org/orekit/rugged/api/RuggedTest.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java
index b39d620b..00a58715 100644
--- a/src/main/java/org/orekit/rugged/api/Rugged.java
+++ b/src/main/java/org/orekit/rugged/api/Rugged.java
@@ -569,7 +569,7 @@ public class Rugged {
             // find the pixel along the line
             final double meanPixel = solver.solve(INVERSE_LOCALIZATION_MAX_EVAL,
                                                   new SensorPixelCrossing(sensor, targetDirection),
-                                                  0, sensor.getNbPixels());
+                                                  -1.0, sensor.getNbPixels());
 
             // TODO: fix pixel offset with respect to mean sensor plane
             final double fixedLine  = meanLine;
diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java
index fbd7234e..ab8c5fe3 100644
--- a/src/test/java/org/orekit/rugged/api/RuggedTest.java
+++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java
@@ -484,7 +484,7 @@ public class RuggedTest {
         double referenceLine = 100.00;
         GeodeticPoint[] gp = rugged.directLocalization("line", referenceLine);
 
-        for (int i = 1; i < gp.length; ++i) {
+        for (int i = 0; i < gp.length; ++i) {
             SensorPixel sp = rugged.inverseLocalization("line", gp[i], 0, dimension);
             Assert.assertEquals(referenceLine, sp.getLineNumber(),  3.0e-9);
             Assert.assertEquals(i,             sp.getPixelNumber(), 8.0e-5);
-- 
GitLab