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

Added ellipsoid dump.

parent 7119b4b7
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ import java.util.TimeZone; ...@@ -25,6 +25,7 @@ import java.util.TimeZone;
import org.apache.commons.math3.util.OpenIntToDoubleHashMap; import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
import org.orekit.rugged.raster.Tile; import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
/** /**
* Dump data class. * Dump data class.
...@@ -38,12 +39,16 @@ class Dump { ...@@ -38,12 +39,16 @@ class Dump {
/** Tiles map. */ /** Tiles map. */
private final List<DumpedTileData> tiles; private final List<DumpedTileData> tiles;
/** Flag for dumped ellipsoid. */
private boolean ellipsoidDumped;
/** Simple constructor. /** Simple constructor.
* @param writer writer to the dump file * @param writer writer to the dump file
*/ */
public Dump(final PrintWriter writer) { public Dump(final PrintWriter writer) {
this.writer = writer; this.writer = writer;
this.tiles = new ArrayList<DumpedTileData>(); this.tiles = new ArrayList<DumpedTileData>();
this.ellipsoidDumped = false;
dumpHeader(); dumpHeader();
} }
...@@ -69,6 +74,19 @@ class Dump { ...@@ -69,6 +74,19 @@ class Dump {
getTileData(tile).setElevation(latitudeIndex, longitudeIndex, elevation); getTileData(tile).setElevation(latitudeIndex, longitudeIndex, elevation);
} }
/** Dump ellipsoid data.
* @param ellipsoid ellipsoid to dump
*/
public void dumpEllipsoid(final ExtendedEllipsoid ellipsoid) {
if (!ellipsoidDumped) {
writer.format(Locale.US,
"ellipsoid: ae = %22.15e f = %22.15e frame = %s%n",
ellipsoid.getA(), ellipsoid.getFlattening(),
ellipsoid.getBodyFrame().getName());
ellipsoidDumped = true;
}
}
/** Get tile data. /** Get tile data.
* @param tile tile to which the cell belongs * @param tile tile to which the cell belongs
* @return index of the tile * @return index of the tile
......
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.orekit.rugged.raster.Tile; import org.orekit.rugged.raster.Tile;
import org.orekit.rugged.utils.ExtendedEllipsoid;
/** /**
* Class managing debug dumps. * Class managing debug dumps.
...@@ -95,4 +96,13 @@ public class DumpManager { ...@@ -95,4 +96,13 @@ public class DumpManager {
} }
} }
/** Dump ellipsoid data.
* @param ellipsoid ellipsoid to dump
*/
public static void dumpEllipsoid(final ExtendedEllipsoid ellipsoid) {
if (isActive()) {
DUMP.get().dumpEllipsoid(ellipsoid);
}
}
} }
...@@ -23,6 +23,7 @@ import org.orekit.bodies.GeodeticPoint; ...@@ -23,6 +23,7 @@ import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid; import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.errors.OrekitException; import org.orekit.errors.OrekitException;
import org.orekit.frames.Frame; import org.orekit.frames.Frame;
import org.orekit.rugged.errors.DumpManager;
import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedException;
import org.orekit.rugged.errors.RuggedMessages; import org.orekit.rugged.errors.RuggedMessages;
import org.orekit.time.AbsoluteDate; import org.orekit.time.AbsoluteDate;
...@@ -70,6 +71,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -70,6 +71,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
final double latitude, final Vector3D closeReference) final double latitude, final Vector3D closeReference)
throws RuggedException { throws RuggedException {
DumpManager.dumpEllipsoid(this);
// find apex of iso-latitude cone, somewhere along polar axis // find apex of iso-latitude cone, somewhere along polar axis
final GeodeticPoint groundPoint = new GeodeticPoint(latitude, 0, 0); final GeodeticPoint groundPoint = new GeodeticPoint(latitude, 0, 0);
final Vector3D gpCartesian = transform(groundPoint); final Vector3D gpCartesian = transform(groundPoint);
...@@ -139,6 +142,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -139,6 +142,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
public Vector3D pointAtLongitude(final Vector3D position, final Vector3D los, final double longitude) public Vector3D pointAtLongitude(final Vector3D position, final Vector3D los, final double longitude)
throws RuggedException { throws RuggedException {
DumpManager.dumpEllipsoid(this);
// normal to meridian // normal to meridian
final Vector3D normal = new Vector3D(-FastMath.sin(longitude), FastMath.cos(longitude), 0); final Vector3D normal = new Vector3D(-FastMath.sin(longitude), FastMath.cos(longitude), 0);
final double d = Vector3D.dotProduct(los, normal); final double d = Vector3D.dotProduct(los, normal);
...@@ -164,6 +169,7 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -164,6 +169,7 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
final double centralLongitude) final double centralLongitude)
throws RuggedException { throws RuggedException {
try { try {
DumpManager.dumpEllipsoid(this);
final GeodeticPoint gp = final GeodeticPoint gp =
getIntersectionPoint(new Line(position, new Vector3D(1, position, 1e6, los), 1.0e-12), getIntersectionPoint(new Line(position, new Vector3D(1, position, 1e6, los), 1.0e-12),
position, getBodyFrame(), null); position, getBodyFrame(), null);
...@@ -188,6 +194,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -188,6 +194,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
throws RuggedException { throws RuggedException {
try { try {
DumpManager.dumpEllipsoid(this);
// point on line closest to origin // point on line closest to origin
final double los2 = los.getNormSq(); final double los2 = los.getNormSq();
final double dot = Vector3D.dotProduct(position, los); final double dot = Vector3D.dotProduct(position, los);
...@@ -239,6 +247,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -239,6 +247,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
*/ */
public Vector3D convertLos(final GeodeticPoint point, final Vector3D los) { public Vector3D convertLos(final GeodeticPoint point, final Vector3D los) {
DumpManager.dumpEllipsoid(this);
// Cartesian coordinates of the topocentric frame origin // Cartesian coordinates of the topocentric frame origin
final Vector3D p3D = transform(point); final Vector3D p3D = transform(point);
...@@ -272,6 +282,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -272,6 +282,8 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
throws RuggedException { throws RuggedException {
try { try {
DumpManager.dumpEllipsoid(this);
// switch to geodetic coordinates using primary point as reference // switch to geodetic coordinates using primary point as reference
final GeodeticPoint point = transform(primary, getBodyFrame(), null); final GeodeticPoint point = transform(primary, getBodyFrame(), null);
final Vector3D los = secondary.subtract(primary); final Vector3D los = secondary.subtract(primary);
...@@ -296,6 +308,7 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { ...@@ -296,6 +308,7 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid {
public NormalizedGeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date, public NormalizedGeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date,
final double centralLongitude) final double centralLongitude)
throws OrekitException { throws OrekitException {
DumpManager.dumpEllipsoid(this);
final GeodeticPoint gp = transform(point, frame, date); final GeodeticPoint gp = transform(point, frame, date);
return new NormalizedGeodeticPoint(gp.getLatitude(), gp.getLongitude(), gp.getAltitude(), return new NormalizedGeodeticPoint(gp.getLatitude(), gp.getLongitude(), gp.getAltitude(),
centralLongitude); centralLongitude);
......
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