diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 95f733edc2de2235f628ec264ddbe35a0d529f01..9820b0ca5dd98b36e60c6c36da67022f571dedc0 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 13a7b36827913854a7d24045224c9838650cd329..a7f29c7a70c56b9d91441e200a5f89e16b8e9d32 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 8c466f590afcde7cc5406a2896a53b7539e1f293..eefb9fad3033dd2d0a9416bbfe9419b41913bd3c 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); } }