diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/GroundPoint.java b/rugged-api/src/main/java/org/orekit/rugged/api/GroundPoint.java new file mode 100644 index 0000000000000000000000000000000000000000..695036683d9fd6a392047e03b9c6c37089759f18 --- /dev/null +++ b/rugged-api/src/main/java/org/orekit/rugged/api/GroundPoint.java @@ -0,0 +1,91 @@ +/* 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/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java b/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java new file mode 100644 index 0000000000000000000000000000000000000000..2fcf9af598e55829b888c6c4789c837b1fb1b496 --- /dev/null +++ b/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java @@ -0,0 +1,33 @@ +/* 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; + +/** Enumerate for line-of-sight intersection algorithm. + * @author Luc Maisonobe + */ +public enum LineOfSightAlgorithm { + + /** Bernardt Duvenhage's algorithm. + * <p> + * The algorithm is described in the 2009 paper: + * <a href="http://researchspace.csir.co.za/dspace/bitstream/10204/3041/1/Duvenhage_2009.pdf">Using + * An Implicit Min/Max KD-Tree for Doing Efficient Terrain Line of Sight Calculations</a>. + * </p> + */ + DUVENHAGE; + +} diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java b/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java new file mode 100644 index 0000000000000000000000000000000000000000..9478170147659283f783816065a54af8422905a1 --- /dev/null +++ b/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java @@ -0,0 +1,52 @@ +/* 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; + +/** Main interface to Rugged library. + * @author Luc Maisonobe + */ +public interface Rugged { + + /** Set up the tiles management. + * @param updater updater used to load Digital Elevation Model tiles + * @param maxCachedTiles maximum number of tiles stored in the cache + */ + void setUpTilesManagement(TileUpdater updater, int maxCachedTiles); + + /** Direct localization of a sensor line. + * @param sensorName name of the sensor + * @param lineNumber number of the line to localize on ground + * @param algorithm algorithm to use for line-of-sight/DEM intersection computation + * @return ground position of all pixels of the specified sensor line + * @exception RuggedException if line cannot be localized + */ + GroundPoint[] directLocalization(String sensorName, int lineNumber, + LineOfSightAlgorithm algorithm) + throws RuggedException; + + /** Inverse localization of a ground point. + * @param sensorName name of the sensor + * @param ground point to localize + * @param algorithm algorithm to use for line-of-sight/DEM intersection computation + * @return sensor pixel seeing ground point + * @exception RuggedException if line cannot be localized + */ + SensorPixel inverseLocalization(String sensorName, GroundPoint groundPoint, + LineOfSightAlgorithm algorithm) + throws RuggedException; + +}