diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 040119bbc37d77d1cc851f42c875805b5c4f6b07..7801ec9f83f21d1adc07f929b04c464b812de3f3 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -476,26 +476,10 @@ public class Rugged { */ public GeodeticPoint[] directLocalization(final String sensorName, final double lineNumber) throws RuggedException { - final LineSensor sensor = getLineSensor(sensorName); - return directLocalization(sensor, 0, sensor.getNbPixels(), algorithm, lineNumber); - } - - /** Direct localization of a sensor line. - * @param sensor line sensor - * @param start start pixel to consider in the line sensor - * @param end end pixel to consider in the line sensor (excluded) - * @param alg intersection algorithm to use - * @param lineNumber number of the line to localize on ground - * @return ground position of all pixels of the specified sensor line - * @exception RuggedException if line cannot be localized, or sensor is unknown - */ - private GeodeticPoint[] directLocalization(final LineSensor sensor, final int start, final int end, - final IntersectionAlgorithm alg, - final double lineNumber) - throws RuggedException { try { // compute the approximate transform between spacecraft and observed body + final LineSensor sensor = getLineSensor(sensorName); final AbsoluteDate date = sensor.getDate(lineNumber); final Transform scToInert = scToBody.getScToInertial(date); final Transform inertToBody = scToBody.getInertialToBody(date); @@ -506,8 +490,8 @@ public class Rugged { // compute localization of each pixel final Vector3D pInert = scToInert.transformPosition(sensor.getPosition()); - final GeodeticPoint[] gp = new GeodeticPoint[end - start]; - for (int i = start; i < end; ++i) { + final GeodeticPoint[] gp = new GeodeticPoint[sensor.getNbPixels()]; + for (int i = 0; i < sensor.getNbPixels(); ++i) { final Vector3D obsLInert = scToInert.transformVector(sensor.getLos(i)); final Vector3D lInert; @@ -536,24 +520,24 @@ public class Rugged { final Vector3D eP1 = ellipsoid.transform(ellipsoid.pointOnGround(sP, sL)); final double deltaT1 = eP1.distance(sP) / Constants.SPEED_OF_LIGHT; final Transform shifted1 = inertToBody.shiftedBy(-deltaT1); - final GeodeticPoint gp1 = alg.intersection(ellipsoid, - shifted1.transformPosition(pInert), - shifted1.transformVector(lInert)); + final GeodeticPoint gp1 = algorithm.intersection(ellipsoid, + shifted1.transformPosition(pInert), + shifted1.transformVector(lInert)); final Vector3D eP2 = ellipsoid.transform(gp1); final double deltaT2 = eP2.distance(sP) / Constants.SPEED_OF_LIGHT; final Transform shifted2 = inertToBody.shiftedBy(-deltaT2); - gp[i - start] = alg.refineIntersection(ellipsoid, - shifted2.transformPosition(pInert), - shifted2.transformVector(lInert), - gp1); + gp[i] = algorithm.refineIntersection(ellipsoid, + shifted2.transformPosition(pInert), + shifted2.transformVector(lInert), + gp1); } else { // compute DEM intersection without light time correction final Vector3D pBody = inertToBody.transformPosition(pInert); final Vector3D lBody = inertToBody.transformVector(lInert); - gp[i - start] = alg.refineIntersection(ellipsoid, pBody, lBody, - alg.intersection(ellipsoid, pBody, lBody)); + gp[i] = algorithm.refineIntersection(ellipsoid, pBody, lBody, + algorithm.intersection(ellipsoid, pBody, lBody)); } } diff --git a/src/main/java/org/orekit/rugged/core/FixedAltitudeAlgorithm.java b/src/main/java/org/orekit/rugged/core/FixedAltitudeAlgorithm.java deleted file mode 100644 index 04a37891db8a56321c8b85f63ef90096c1e24f5d..0000000000000000000000000000000000000000 --- a/src/main/java/org/orekit/rugged/core/FixedAltitudeAlgorithm.java +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2013-2014 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.core; - -import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; -import org.orekit.bodies.GeodeticPoint; -import org.orekit.errors.OrekitException; -import org.orekit.rugged.api.RuggedException; -import org.orekit.rugged.core.raster.IntersectionAlgorithm; - -/** Intersection using a fixed altitude. - * @author Luc Maisonobe - */ -public class FixedAltitudeAlgorithm implements IntersectionAlgorithm { - - /** Fixed altitude to use. */ - private final double altitude; - - /** Simple constructor. - * @param altitude fixed altitude to use - */ - public FixedAltitudeAlgorithm(final double altitude) { - this.altitude = altitude; - } - - /** {@inheritDoc} */ - @Override - public GeodeticPoint intersection(final ExtendedEllipsoid ellipsoid, - final Vector3D position, final Vector3D los) - throws RuggedException { - try { - return ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, altitude), - ellipsoid.getBodyFrame(), null); - } catch (OrekitException oe) { - // this should never happen - throw new RuggedException(oe, oe.getSpecifier(), oe.getParts()); - } - } - - /** {@inheritDoc} */ - @Override - public GeodeticPoint refineIntersection(final ExtendedEllipsoid ellipsoid, - final Vector3D position, final Vector3D los, - final GeodeticPoint closeGuess) - throws RuggedException { - return intersection(ellipsoid, position, los); - } - -}