From 996bd517d1d9b9ebbbe7830bdaa348e10db2fe5b Mon Sep 17 00:00:00 2001 From: Guylaine Prat <guylaine.prat@c-s.fr> Date: Tue, 15 Jan 2019 16:00:04 +0100 Subject: [PATCH] Remove direct loc optimization (which was a WIP) --- .../java/org/orekit/rugged/api/Rugged.java | 67 +++---------------- .../java/org/orekit/rugged/los/PixelLOS.java | 62 ----------------- 2 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 src/main/java/org/orekit/rugged/los/PixelLOS.java diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 63afee42..6c09b7b5 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -34,7 +34,6 @@ import org.orekit.rugged.linesensor.LineSensor; import org.orekit.rugged.linesensor.SensorMeanPlaneCrossing; import org.orekit.rugged.linesensor.SensorPixel; import org.orekit.rugged.linesensor.SensorPixelCrossing; -import org.orekit.rugged.los.PixelLOS; import org.orekit.rugged.refraction.AtmosphericRefraction; import org.orekit.rugged.utils.DSGenerator; import org.orekit.rugged.utils.ExtendedEllipsoid; @@ -287,25 +286,16 @@ public class Rugged { final Vector3D pBody = inertToBody.transformPosition(pInert); final Vector3D lBody = inertToBody.transformVector(lInert); gp[i] = algorithm.refineIntersection(ellipsoid, pBody, lBody, - algorithm.intersection(ellipsoid, pBody, lBody)); + algorithm.intersection(ellipsoid, pBody, lBody)); } // compute with atmospheric refraction correction if necessary if (atmosphericRefraction != null && atmosphericRefraction.mustBeComputed()) { - // Test if optimization is not required - if (!atmosphericRefraction.isOptimized()) { - - // apply atmospheric refraction correction - final Vector3D pBody = inertToBody.transformPosition(pInert); - final Vector3D lBody = inertToBody.transformVector(lInert); - gp[i] = atmosphericRefraction.applyCorrection(pBody, lBody, (NormalizedGeodeticPoint) gp[i], algorithm); - - } else { // Optimization is required - - // TODO algo with optimization - throw new RuggedException(RuggedMessages.UNINITIALIZED_CONTEXT, "atmospheric optimization not defined"); - } + // apply atmospheric refraction correction + final Vector3D pBody = inertToBody.transformPosition(pInert); + final Vector3D lBody = inertToBody.transformVector(lInert); + gp[i] = atmosphericRefraction.applyCorrection(pBody, lBody, (NormalizedGeodeticPoint) gp[i], algorithm); } DumpManager.dumpDirectLocationResult(gp[i]); } @@ -313,9 +303,6 @@ public class Rugged { } /** Direct location of a single line-of-sight. - * <p> - * NB: if (the optionnal) atmospheric refraction must be computed with the optimization algorithm, - * see {@link #directLocation(AbsoluteDate, Vector3D, PixelLOS)}. * @param date date of the location * @param sensorPosition sensor position in spacecraft frame. For simplicity, due to the size of sensor, * we consider each pixel to be at sensor position @@ -324,28 +311,6 @@ public class Rugged { */ public GeodeticPoint directLocation(final AbsoluteDate date, final Vector3D sensorPosition, final Vector3D los) { - // Set the pixel to null in order not to compute atmosphere with optimization - final PixelLOS pixelLOS = new PixelLOS(null, los); - - return directLocation(date, sensorPosition, pixelLOS); - } - - - /** Direct location of a single line-of-sight. - * <p> - * NB: if the atmospheric refraction must be computed without the optimization algorithm, - * see {@link #directLocation(AbsoluteDate, Vector3D, Vector3D)}. - * @param date date of the location - * @param sensorPosition sensor position in spacecraft frame. For simplicity, due to the size of sensor, - * we consider each pixel to be at sensor position - * @param pixelLOS pixel definition with normalized line-of-sight in spacecraft frame - * @return ground position of intersection point between specified los and ground - * @since 2.1 - */ - public GeodeticPoint directLocation(final AbsoluteDate date, final Vector3D sensorPosition, final PixelLOS pixelLOS) { - - final Vector3D los = pixelLOS.getLOS(); - // TODO change dump to add sensorPixel DumpManager.dumpDirectLocation(date, sensorPosition, los, lightTimeCorrection, aberrationOfLightCorrection, atmosphericRefraction != null); @@ -386,31 +351,19 @@ public class Rugged { final Vector3D pBody = inertToBody.transformPosition(pInert); final Vector3D lBody = inertToBody.transformVector(lInert); gp = algorithm.refineIntersection(ellipsoid, pBody, lBody, - algorithm.intersection(ellipsoid, pBody, lBody)); + algorithm.intersection(ellipsoid, pBody, lBody)); } NormalizedGeodeticPoint result = gp; // compute the ground location with atmospheric correction if asked for if (atmosphericRefraction != null && atmosphericRefraction.mustBeComputed()) { - // TBN: two methods exist for computation of the atmospheric correction - // * a full computation - // * a time optimized computation based on an interpolation grid - - // Test if optimization is not required or if sensor pixel is not defined (impossible to perform optimization) - if (!atmosphericRefraction.isOptimized() || pixelLOS.getSensorPixel() == null) { - // apply atmospheric refraction correction (full computation) - final Vector3D pBody = inertToBody.transformPosition(pInert); - final Vector3D lBody = inertToBody.transformVector(lInert); - result = atmosphericRefraction.applyCorrection(pBody, lBody, gp, algorithm); - - } else { // Optimization is required and sensor pixel is defined - - // TODO to be done - throw new RuggedException(RuggedMessages.UNINITIALIZED_CONTEXT, "Atmospheric optimization for direct loc"); + // apply atmospheric refraction correction + final Vector3D pBody = inertToBody.transformPosition(pInert); + final Vector3D lBody = inertToBody.transformVector(lInert); + result = atmosphericRefraction.applyCorrection(pBody, lBody, gp, algorithm); - } // end test on optimization is required } // end test on atmosphericRefraction != null DumpManager.dumpDirectLocationResult(result); diff --git a/src/main/java/org/orekit/rugged/los/PixelLOS.java b/src/main/java/org/orekit/rugged/los/PixelLOS.java deleted file mode 100644 index 8f44c1a8..00000000 --- a/src/main/java/org/orekit/rugged/los/PixelLOS.java +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2013-2018 CS Systèmes d'Information - * Licensed to CS Systèmes d'Information (CS) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * CS licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.orekit.rugged.los; - -import java.io.Serializable; - -import org.hipparchus.geometry.euclidean.threed.Vector3D; -import org.orekit.rugged.linesensor.SensorPixel; - -/** Container for pixel line-of-sight. - * @author Guylaine Prat - * @since 2.1 - */ -public class PixelLOS implements Serializable { - - /** Serializable UID. */ - private static final long serialVersionUID = -6674056279573271367L; - - /** Sensor pixel. */ - private final SensorPixel sensorPixel; - - /** Pixel line-of-sight in spacecraft frame. */ - private final Vector3D los; - - /** - * Build a new instance. - * @param sensorPixel the sensor pixel cell - * @param los the pixel line-of-sight in spacecraft frame - */ - public PixelLOS(final SensorPixel sensorPixel, final Vector3D los) { - this.sensorPixel = sensorPixel; - this.los = los; - } - - /** - * @return the sensorPixel - */ - public SensorPixel getSensorPixel() { - return sensorPixel; - } - - /** - * @return the lOS in spacecraft frame - */ - public Vector3D getLOS() { - return los; - } -} -- GitLab