From ea54feacf4bf9a1d5453daee2f953c745e03de4a Mon Sep 17 00:00:00 2001
From: Guylaine Prat <guylaine.prat@c-s.fr>
Date: Tue, 18 Sep 2018 11:50:01 +0200
Subject: [PATCH] Add precision about sensor/pixel position (the same) in
 javadoc, comment and method parameters

---
 .../java/org/orekit/rugged/api/Rugged.java    | 24 +++++++++++++------
 .../java/org/orekit/rugged/errors/Dump.java   |  6 ++---
 .../org/orekit/rugged/errors/DumpManager.java |  6 ++---
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java
index 95f733ed..9820b0ca 100644
--- a/src/main/java/org/orekit/rugged/api/Rugged.java
+++ b/src/main/java/org/orekit/rugged/api/Rugged.java
@@ -241,8 +241,11 @@ public class Rugged {
         final Vector3D spacecraftVelocity =
                 scToInert.transformPVCoordinates(PVCoordinates.ZERO).getVelocity();
 
-        // compute location of each pixel
+        // compute sensor position in inertial frame
+        // TBN: for simplicity, due to the size of sensor, we consider each pixel to be at sensor position
         final Vector3D pInert    = scToInert.transformPosition(sensor.getPosition());
+
+        // compute location of each pixel
         final GeodeticPoint[] gp = new GeodeticPoint[sensor.getNbPixels()];
         for (int i = 0; i < sensor.getNbPixels(); ++i) {
 
@@ -271,6 +274,8 @@ public class Rugged {
 
             if (lightTimeCorrection) {
                 // compute DEM intersection with light time correction
+
+                // TBN: for simplicity, due to the size of sensor, we consider each pixel to be at sensor position
                 final Vector3D  sP       = approximate.transformPosition(sensor.getPosition());
                 final Vector3D  sL       = approximate.transformVector(sensor.getLOS(date, i));
                 final Vector3D  eP1      = ellipsoid.transform(ellipsoid.pointOnGround(sP, sL, 0.0));
@@ -312,16 +317,17 @@ public class Rugged {
     }
 
     /** Direct location of a single line-of-sight.
+     *  TBN: for simplicity, due to the size of sensor, we consider each pixel to be at sensor position
      * @param date date of the location
-     * @param position pixel position in spacecraft frame
+     * @param sensorPosition sensor position in spacecraft frame
      * @param los normalized line-of-sight in spacecraft frame
      * @return ground position of intersection point between specified los and ground
      * @exception RuggedException if line cannot be localized, or sensor is unknown
      */
-    public GeodeticPoint directLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los)
+    public GeodeticPoint directLocation(final AbsoluteDate date, final Vector3D sensorPosition, final Vector3D los)
         throws RuggedException {
 
-        DumpManager.dumpDirectLocation(date, position, los, lightTimeCorrection, aberrationOfLightCorrection,
+        DumpManager.dumpDirectLocation(date, sensorPosition, los, lightTimeCorrection, aberrationOfLightCorrection,
                                        atmosphericRefraction != null);
 
         // compute the approximate transform between spacecraft and observed body
@@ -332,9 +338,11 @@ public class Rugged {
         final Vector3D spacecraftVelocity =
                 scToInert.transformPVCoordinates(PVCoordinates.ZERO).getVelocity();
 
-        // compute location of specified pixel
-        final Vector3D pInert    = scToInert.transformPosition(position);
+        // compute sensor position in inertial frame
+        // TBN: for simplicity, due to the size of sensor, we consider each pixel to be at sensor position
+        final Vector3D pInert    = scToInert.transformPosition(sensorPosition);
 
+        // compute location of specified pixel
         final Vector3D obsLInert = scToInert.transformVector(los);
         final Vector3D lInert;
         if (aberrationOfLightCorrection) {
@@ -358,7 +366,8 @@ public class Rugged {
         final NormalizedGeodeticPoint gp;
         if (lightTimeCorrection) {
             // compute DEM intersection with light time correction
-            final Vector3D  sP       = approximate.transformPosition(position);
+            // TBN: for simplicity, due to the size of sensor, we consider each pixel to be at sensor position
+            final Vector3D  sP       = approximate.transformPosition(sensorPosition);
             final Vector3D  sL       = approximate.transformVector(los);
             final Vector3D  eP1      = ellipsoid.transform(ellipsoid.pointOnGround(sP, sL, 0.0));
             final double    deltaT1  = eP1.distance(sP) / Constants.SPEED_OF_LIGHT;
@@ -389,6 +398,7 @@ public class Rugged {
             final Vector3D pBody = inertToBody.transformPosition(pInert);
             final Vector3D lBody = inertToBody.transformVector(lInert);
             result = atmosphericRefraction.applyCorrection(pBody, lBody, gp, algorithm);
+
         } else {
             // don't apply atmospheric refraction correction
             result = gp;
diff --git a/src/main/java/org/orekit/rugged/errors/Dump.java b/src/main/java/org/orekit/rugged/errors/Dump.java
index 13a7b368..a7f29c7a 100644
--- a/src/main/java/org/orekit/rugged/errors/Dump.java
+++ b/src/main/java/org/orekit/rugged/errors/Dump.java
@@ -145,21 +145,21 @@ class Dump {
 
     /** Dump a direct location computation.
      * @param date date of the location
-     * @param position pixel position in spacecraft frame
+     * @param sensorPosition sensor position in spacecraft frame
      * @param los normalized line-of-sight in spacecraft frame
      * @param lightTimeCorrection flag for light time correction
      * @param aberrationOfLightCorrection flag for aberration of light correction
      * @param refractionCorrection flag for refraction correction
      * @exception RuggedException if date cannot be converted to UTC
      */
-    public void dumpDirectLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los,
+    public void dumpDirectLocation(final AbsoluteDate date, final Vector3D sensorPosition, final Vector3D los,
                                    final boolean lightTimeCorrection, final boolean aberrationOfLightCorrection,
                                    final boolean refractionCorrection)
         throws RuggedException {
         writer.format(Locale.US,
                       "direct location: date %s position %22.15e %22.15e %22.15e los %22.15e %22.15e %22.15e lightTime %b aberration %b refraction %b %n",
                       convertDate(date),
-                      position.getX(), position.getY(), position.getZ(),
+                      sensorPosition.getX(), sensorPosition.getY(), sensorPosition.getZ(),
                       los.getX(),      los.getY(),      los.getZ(),
                       lightTimeCorrection, aberrationOfLightCorrection, refractionCorrection);
     }
diff --git a/src/main/java/org/orekit/rugged/errors/DumpManager.java b/src/main/java/org/orekit/rugged/errors/DumpManager.java
index 8c466f59..eefb9fad 100644
--- a/src/main/java/org/orekit/rugged/errors/DumpManager.java
+++ b/src/main/java/org/orekit/rugged/errors/DumpManager.java
@@ -135,19 +135,19 @@ public class DumpManager {
 
     /** Dump a direct location computation.
      * @param date date of the location
-     * @param position pixel position in spacecraft frame
+     * @param sensorPosition sensor position in spacecraft frame
      * @param los normalized line-of-sight in spacecraft frame
      * @param lightTimeCorrection flag for light time correction
      * @param aberrationOfLightCorrection flag for aberration of light correction
      * @param refractionCorrection flag for refraction correction
      * @exception RuggedException if date cannot be converted to UTC
      */
-    public static void dumpDirectLocation(final AbsoluteDate date, final Vector3D position, final Vector3D los,
+    public static void dumpDirectLocation(final AbsoluteDate date, final Vector3D sensorPosition, final Vector3D los,
                                           final boolean lightTimeCorrection, final boolean aberrationOfLightCorrection,
                                           final boolean refractionCorrection)
         throws RuggedException {
         if (isActive()) {
-            DUMP.get().dumpDirectLocation(date, position, los, lightTimeCorrection, aberrationOfLightCorrection,
+            DUMP.get().dumpDirectLocation(date, sensorPosition, los, lightTimeCorrection, aberrationOfLightCorrection,
                     refractionCorrection);
         }
     }
-- 
GitLab