Skip to content
Snippets Groups Projects
Commit 8d0b513e authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Slight speed-up with a dedicated pointOnGround method.

parent 1e4b657b
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
*/
package org.orekit.rugged.core;
import org.apache.commons.math3.geometry.euclidean.threed.Line;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.util.FastMath;
import org.orekit.bodies.GeodeticPoint;
......@@ -145,6 +146,18 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
}
/** Get point on ground along a pixel line of sight.
* @param position pixel position (in body frame)
* @param los pixel line-of-sight, not necessarily normalized (in body frame)
* @return point on ground
* @exception OrekitException if no such point exists (typically line-of-sight missing body)
*/
public GeodeticPoint pointOnGround(final Vector3D position, final Vector3D los)
throws OrekitException {
return getIntersectionPoint(new Line(position, new Vector3D(1, position, 1e6, los), 1.0e-12),
position, getBodyFrame(), null);
}
/** Get point at some altitude along a pixel line of sight.
* @param position pixel position (in body frame)
* @param los pixel line-of-sight, not necessarily normalized (in body frame)
......
......@@ -48,8 +48,7 @@ public class IgnoreDEMAlgorithm implements IntersectionAlgorithm {
final Vector3D position, final Vector3D los)
throws RuggedException {
try {
return ellipsoid.transform(ellipsoid.pointAtAltitude(position, los, 0.0),
ellipsoid.getBodyFrame(), null);
return ellipsoid.pointOnGround(position, los);
} catch (OrekitException oe) {
// this should never happen
throw new RuggedException(oe, oe.getSpecifier(), oe.getParts());
......
......@@ -63,8 +63,7 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
try {
// compute intersection with ellipsoid
final Vector3D p0 = ellipsoid.pointAtAltitude(position, los, 0.0);
final GeodeticPoint gp0 = ellipsoid.transform(p0, ellipsoid.getBodyFrame(), null);
final GeodeticPoint gp0 = ellipsoid.pointOnGround(position, los);
// locate the entry tile along the line-of-sight
MinMaxTreeTile tile = cache.getTile(gp0.getLatitude(), gp0.getLongitude());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment