diff --git a/src/main/java/org/orekit/rugged/api/GroundPoint.java b/src/main/java/org/orekit/rugged/api/GroundPoint.java deleted file mode 100644 index 695036683d9fd6a392047e03b9c6c37089759f18..0000000000000000000000000000000000000000 --- a/src/main/java/org/orekit/rugged/api/GroundPoint.java +++ /dev/null @@ -1,91 +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.api; - -import java.io.Serializable; - -import org.apache.commons.math3.util.FastMath; -import org.apache.commons.math3.util.MathUtils; - -/** Container for ground point. - * <p> - * This class is a stripped-down version of Orekit {@link org.orekit.bodies.GeodeticPoint}, - * which is distributed under the terms of the Apache License V2. - * </p> - * <p> - * Instances of this class are guaranteed to be immutable. - * </p> - * @author Luc Maisonobe - */ -public class GroundPoint implements Serializable { - - /** Serializable UID. */ - private static final long serialVersionUID = 20140309L; - - /** Latitude of the point (rad). */ - private final double latitude; - - /** Longitude of the point (rad). */ - private final double longitude; - - /** Altitude of the point (m). */ - private final double altitude; - - /** - * Build a new instance. The angular coordinates will be normalized so that - * the latitude is between ±π/2 and the longitude is between ±π. - * - * @param latitude latitude of the point - * @param longitude longitude of the point - * @param altitude altitude of the point - */ - public GroundPoint(final double latitude, final double longitude, final double altitude) { - double lat = MathUtils.normalizeAngle(latitude, FastMath.PI / 2); - double lon = MathUtils.normalizeAngle(longitude, 0); - if (lat > FastMath.PI / 2.0) { - // latitude is beyond the pole -> add 180 to longitude - lat = FastMath.PI - lat; - lon = MathUtils.normalizeAngle(longitude + FastMath.PI, 0); - - } - this.latitude = lat; - this.longitude = lon; - this.altitude = altitude; - } - - /** Get the latitude. - * @return latitude, an angular value in the range [-π/2, π/2] - */ - public double getLatitude() { - return latitude; - } - - /** Get the longitude. - * @return longitude, an angular value in the range [-π, π] - */ - public double getLongitude() { - return longitude; - } - - /** Get the altitude. - * @return altitude - */ - public double getAltitude() { - return altitude; - } - -} diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 3bd0297c0e536bb7067e4ca2382e0a8cbcc7d5ae..d00b6d23b9d0904ebff4864ecb2cdd3656b1ed91 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -19,6 +19,8 @@ package org.orekit.rugged.api; import java.io.File; import java.util.List; +import org.orekit.bodies.GeodeticPoint; + /** Main interface to Rugged library. * @author Luc Maisonobe */ @@ -151,7 +153,7 @@ public interface Rugged { * not been called beforehand, or if {@link #setOrbitAndAttitude(List, List)} has not * been called beforehand, or sensor is unknown */ - GroundPoint[] directLocalization(String name, double lineNumber) + GeodeticPoint[] directLocalization(String name, double lineNumber) throws RuggedException; /** Inverse localization of a ground point. @@ -163,7 +165,7 @@ public interface Rugged { * not been called beforehand, or if {@link #setOrbitAndAttitude(List, List)} has not * been called beforehand, or sensor is unknown */ - SensorPixel inverseLocalization(String name, GroundPoint groundPoint) + SensorPixel inverseLocalization(String name, GeodeticPoint groundPoint) throws RuggedException; } diff --git a/src/main/java/org/orekit/rugged/core/RuggedImpl.java b/src/main/java/org/orekit/rugged/core/RuggedImpl.java index d93cda3c1c3a4c1da4289318717a8fd5c1ba30e7..c9bc91dd5f1e5c5f4ec752998c8b73d452063c04 100644 --- a/src/main/java/org/orekit/rugged/core/RuggedImpl.java +++ b/src/main/java/org/orekit/rugged/core/RuggedImpl.java @@ -37,7 +37,6 @@ import org.orekit.frames.Transform; import org.orekit.orbits.CartesianOrbit; import org.orekit.orbits.Orbit; import org.orekit.propagation.Propagator; -import org.orekit.rugged.api.GroundPoint; import org.orekit.rugged.api.LineDatation; import org.orekit.rugged.api.PixelLOS; import org.orekit.rugged.api.Rugged; @@ -367,7 +366,7 @@ public class RuggedImpl implements Rugged { /** {@inheritDoc} */ @Override - public GroundPoint[] directLocalization(final String sensorName, final double lineNumber) + public GeodeticPoint[] directLocalization(final String sensorName, final double lineNumber) throws RuggedException { try { @@ -383,7 +382,7 @@ public class RuggedImpl implements Rugged { final Transform approximate = new Transform(date, scToInert, inertToBody); // compute localization of each pixel - final GroundPoint[] gp = new GroundPoint[sensor.getNbPixels()]; + final GeodeticPoint[] gp = new GeodeticPoint[sensor.getNbPixels()]; for (int i = 0; i < gp.length; ++i) { // fix light travel time @@ -393,13 +392,9 @@ public class RuggedImpl implements Rugged { final double deltaT = eP.distance(sP) / Constants.SPEED_OF_LIGHT; final Transform fixed = new Transform(date, scToInert, inertToBody.shiftedBy(-deltaT)); - final GeodeticPoint geodetic = - algorithm.intersection(ellipsoid, + gp[i] = algorithm.intersection(ellipsoid, fixed.transformPosition(sensor.getPosition(i)), fixed.transformVector(sensor.getLos(i))); - gp[i] = new GroundPoint(geodetic.getLatitude(), - geodetic.getLongitude(), - geodetic.getAltitude()); } return gp; @@ -411,7 +406,7 @@ public class RuggedImpl implements Rugged { /** {@inheritDoc} */ @Override - public SensorPixel inverseLocalization(final String sensorName, final GroundPoint groundPoint) + public SensorPixel inverseLocalization(final String sensorName, final GeodeticPoint groundPoint) throws RuggedException { checkContext(); diff --git a/src/test/java/org/orekit/rugged/core/RuggedImplTest.java b/src/test/java/org/orekit/rugged/core/RuggedImplTest.java index 477bba5b5909a5dbd2d94d07c24e0213242bdc30..3f3929a054ed5d52e5ce4dd3bcba16d73b94b826 100644 --- a/src/test/java/org/orekit/rugged/core/RuggedImplTest.java +++ b/src/test/java/org/orekit/rugged/core/RuggedImplTest.java @@ -59,7 +59,6 @@ import org.orekit.orbits.PositionAngle; import org.orekit.propagation.Propagator; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.numerical.NumericalPropagator; -import org.orekit.rugged.api.GroundPoint; import org.orekit.rugged.api.LineDatation; import org.orekit.rugged.api.LinearLineDatation; import org.orekit.rugged.api.PixelLOS; @@ -226,7 +225,7 @@ public class RuggedImplTest { long t1 = System.currentTimeMillis(); int pixels = 0; for (double line = firstLine; line < lastLine; line++) { - GroundPoint[] gp = rugged.directLocalization("line", line); + GeodeticPoint[] gp = rugged.directLocalization("line", line); for (int i = 0; i < gp.length; ++i) { final int latCode = (int) FastMath.rint(FastMath.scalb(gp[i].getLatitude(), 29)); final int lonCode = (int) FastMath.rint(FastMath.scalb(gp[i].getLongitude(), 29));