diff --git a/src/main/java/org/orekit/rugged/adjustment/LeastSquareAdjuster.java b/src/main/java/org/orekit/rugged/adjustment/LeastSquareAdjuster.java index 54ab12053e9302f7ba04f4f7e7e77b56e8e4d3f6..eb19e374348412deff5a543c70bfb7ddae9ed611 100644 --- a/src/main/java/org/orekit/rugged/adjustment/LeastSquareAdjuster.java +++ b/src/main/java/org/orekit/rugged/adjustment/LeastSquareAdjuster.java @@ -25,7 +25,9 @@ import org.hipparchus.optim.nonlinear.vector.leastsquares.LevenbergMarquardtOpti import org.orekit.rugged.errors.RuggedException; /** LeastSquareAdjuster - * class for setting least square algorithm chosen for solving optimization problem. + * Class for setting least square algorithm chosen for solving optimization problem. + * @author Jonathan Guinet + * @author Lucie Labat-Allee * @author Guylaine Prat * @since 2.0 */ @@ -40,16 +42,14 @@ public class LeastSquareAdjuster { /** Constructor. * @param optimizerID optimizer choice */ - // TODO GP public protected ??? - LeastSquareAdjuster(final OptimizerId optimizerID) { + public LeastSquareAdjuster(final OptimizerId optimizerID) { this.optimizerID = optimizerID; this.adjuster = this.selectOptimizer(); } /** Default constructor with Gauss Newton with QR decomposition algorithm.*/ - // TODO GP public protected ??? - LeastSquareAdjuster() { + public LeastSquareAdjuster() { this.optimizerID = OptimizerId.GAUSS_NEWTON_QR; this.adjuster = this.selectOptimizer(); diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java index 5119f264448ea9afbb3e40687481e465b2abbb4f..9a634a9a13b03a6251561ebaa07d30392535a428 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java @@ -1373,7 +1373,6 @@ public class RuggedTest { Assert.assertEquals(lastLine, recomputedLastLine, maxLineError); } - // TODO add refining tests @Test public void testDistanceBetweenLOS() throws RuggedException { diff --git a/src/test/java/org/orekit/rugged/utils/RefiningTest.java b/src/test/java/org/orekit/rugged/utils/RefiningTest.java index 41f7aadfcd66825dfd637b2e4b5925d86a9ef4d4..d6f5e75c3dc56465830097a1000754a9c230d2a2 100644 --- a/src/test/java/org/orekit/rugged/utils/RefiningTest.java +++ b/src/test/java/org/orekit/rugged/utils/RefiningTest.java @@ -674,9 +674,9 @@ class PleiadesViewingModel { public TimeDependentLOS buildLOS() { final LOSBuilder losBuilder = rawLOS(new Rotation(Vector3D.PLUS_I, - FastMath.toRadians(incidenceAngle), - RotationConvention.VECTOR_OPERATOR).applyTo(Vector3D.PLUS_K), - Vector3D.PLUS_I, FastMath.toRadians(FOV / 2), DIMENSION); + FastMath.toRadians(incidenceAngle), + RotationConvention.VECTOR_OPERATOR).applyTo(Vector3D.PLUS_K), + Vector3D.PLUS_I, FastMath.toRadians(FOV / 2), DIMENSION); losBuilder.addTransform(new FixedRotation(sensorName + RefiningTest.rollSuffix, Vector3D.MINUS_I, 0.00)); losBuilder.addTransform(new FixedRotation(sensorName + RefiningTest.pitchSuffix, Vector3D.MINUS_J, 0.00)); @@ -738,7 +738,6 @@ class PleiadesViewingModel { // los: swath in the (YZ) plane, looking at 50° roll, 2.6" per pixel final Vector3D msiOffset = new Vector3D(0, 0, 0); - // TODO build complex los final TimeDependentLOS lineOfSight = buildLOS(); final double rate = 1. / LINE_PERIOD; diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java index 1995159deb2316438f4f76faaf65d6c378a55528..b17e11838d5fae359b10a5653302be9b28fcdfcc 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/GroundRefining.java @@ -271,10 +271,8 @@ public class GroundRefining extends Refining { los = lineSensor.getLOS(lineDate_y,0); GeodeticPoint lowerLeft = rugged.directLocation(lineDate_y, position, los); - double gsdX = DistanceTools.computeDistanceInMeter(upLeftPoint.getLongitude(), upLeftPoint.getLatitude(), - upperRight.getLongitude() , upperRight.getLatitude())/dimension; - double gsdY = DistanceTools.computeDistanceInMeter(upLeftPoint.getLongitude(), upLeftPoint.getLatitude(), - lowerLeft.getLongitude() , lowerLeft.getLatitude())/dimension; + double gsdX = DistanceTools.computeDistanceInMeter(upLeftPoint, upperRight)/dimension; + double gsdY = DistanceTools.computeDistanceInMeter(upLeftPoint, lowerLeft)/dimension; double [] gsd = {gsdX, gsdY}; return gsd; diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java index d7b6d53e710413fc27b5e07c273547c321817bfa..9ec880ba750f7bf5262413c8fc546c909a321409 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/InterRefining.java @@ -365,8 +365,7 @@ public class InterRefining extends Refining { FastMath.toDegrees(lastPointB.getLatitude()), FastMath.toDegrees(lastPointB.getLongitude()),lastPointB.getAltitude()); - double distance = DistanceTools.computeDistanceInMeter(centerPointA.getLongitude(), centerPointA.getLatitude(), - centerPointB.getLongitude(), centerPointB.getLatitude()); + double distance = DistanceTools.computeDistanceInMeter(centerPointA, centerPointB); return distance; } diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java index 3c67f6dbb5e5b2f83687ab69eaae21a6756414b1..49c56cbd1021b6302f44b5ed27825863030be132 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/generators/InterMeasurementGenerator.java @@ -203,8 +203,7 @@ public class InterMeasurementGenerator implements Measurable { final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(), sensorB.getLOS(dateB, pixelB)); - final double geoDistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(), - gpB.getLongitude(), gpB.getLatitude()); + final double geoDistance = DistanceTools.computeDistanceInMeter(gpA, gpB); if (geoDistance < this.outlier) { @@ -285,8 +284,7 @@ public class InterMeasurementGenerator implements Measurable { final GeodeticPoint gpB = ruggedB.directLocation(dateB, sensorB.getPosition(), sensorB.getLOS(dateB, pixelB)); - final double geoDistance = DistanceTools.computeDistanceInMeter(gpA.getLongitude(), gpA.getLatitude(), - gpB.getLongitude(), gpB.getLatitude()); + final double geoDistance = DistanceTools.computeDistanceInMeter(gpA, gpB); // Create the inter mapping if distance is below outlier value if (geoDistance < outlier) { diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/DistanceTools.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/DistanceTools.java index 4a938d1c339dfccd4c6e378b0747761393f16d86..ae8effcb6bb3cc2e10aa45765c0d6d4a6c9dd045 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/DistanceTools.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/DistanceTools.java @@ -18,11 +18,11 @@ package fr.cs.examples.refiningPleiades.metrics; import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.util.FastMath; +import org.orekit.bodies.GeodeticPoint; import org.orekit.utils.Constants; /** - * Class for computing geodetic distance. - * TODO GP voir avec Luc si pas d'outil dans orekit ??? + * Class for computing geodetic and anguler distance between two geodetic points. * @author Jonathan Guinet * @author Guylaine Prat * @since 2.0 @@ -35,53 +35,44 @@ public class DistanceTools { } /** Choice the method for computing geodetic distance between two points. - * @param long1 Longitude of first geodetic point (rad) - * @param lat1 Latitude of first geodetic point (rad) - * @param long2 Longitude of second geodetic point (rad) - * @param lat2 Latitude of second geodetic point (rad) + * @param geoPoint1 first geodetic point (rad) + * @param geoPoint2 second geodetic point (rad) * @param computeAngular if true, distance will be angular, otherwise will be in meters * @return distance in meters or radians if flag computeAngular is true */ - public static double computeDistance(final double long1, final double lat1, - final double long2, final double lat2, + public static double computeDistance(final GeodeticPoint geoPoint1, final GeodeticPoint geoPoint2, final boolean computeAngular) { if (computeAngular == true) { - return computeDistanceAngular(long1, lat1, long2, lat2); + return computeDistanceAngular(geoPoint1, geoPoint2); } else { - return computeDistanceInMeter(long1, lat1, long2, lat2); + return computeDistanceInMeter(geoPoint1, geoPoint2); } } - /** Compute a geodetic distance in meters between point (long1, lat1) and point (long2, lat2). - * @param long1 Longitude of first geodetic point (rad) - * @param lat1 Latitude of first geodetic point (rad) - * @param long2 Longitude of second geodetic point (rad) - * @param lat2 Latitude of second geodetic point (rad) + /** Compute a geodetic distance in meters between two geodetic points.. + * @param geoPoint1 first geodetic point (rad) + * @param geoPoint2 second geodetic point (rad) * @return distance in meters */ - public static double computeDistanceInMeter(final double long1, final double lat1, - final double long2, final double lat2) { + public static double computeDistanceInMeter(final GeodeticPoint geoPoint1, final GeodeticPoint geoPoint2) { // get vectors on unit sphere from angular coordinates - final Vector3D p1 = new Vector3D(lat1, long1); // - final Vector3D p2 = new Vector3D(lat2, long2); + final Vector3D p1 = new Vector3D(geoPoint1.getLatitude(), geoPoint1.getLongitude()); // + final Vector3D p2 = new Vector3D(geoPoint2.getLatitude(), geoPoint2.getLongitude()); final double distance = Constants.WGS84_EARTH_EQUATORIAL_RADIUS * Vector3D.angle(p1, p2); return distance; } /** Compute an angular distance between two geodetic points. - * @param long1 Longitude of first geodetic point (rad) - * @param lat1 Latitude of first geodetic point (rad) - * @param long2 Longitude of second geodetic point (rad) - * @param lat2 Latitude of second geodetic point (rad) + * @param geoPoint1 first geodetic point (rad) + * @param geoPoint2 second geodetic point (rad) * @return angular distance in radians */ - public static double computeDistanceAngular(final double long1, final double lat1, - final double long2, final double lat2) { + public static double computeDistanceAngular(final GeodeticPoint geoPoint1, final GeodeticPoint geoPoint2) { - final double lonDiff = long1 - long2; - final double latDiff = lat1 - lat2; + final double lonDiff = geoPoint1.getLongitude() - geoPoint2.getLongitude(); + final double latDiff = geoPoint1.getLatitude() - geoPoint2.getLatitude(); return FastMath.hypot(lonDiff, latDiff); } } diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/LocalisationMetrics.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/LocalisationMetrics.java index 9071e5ac698e82ebe0b21e5bfe12e5828ce57fcf..596c8203996f024dbaead3a2c0653d657bcbcae1 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/LocalisationMetrics.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/metrics/LocalisationMetrics.java @@ -143,9 +143,7 @@ public class LocalisationMetrics { lineSensor.getLOS(date, (int) gtSP.getPixelNumber())); // Compute distance - double distance = DistanceTools.computeDistance(esGP.getLongitude(), esGP.getLatitude(), - gtGP.getLongitude(), gtGP.getLatitude(), - computeAngular); + double distance = DistanceTools.computeDistance(esGP, gtGP, computeAngular); count += distance; if (distance > resMax) { resMax = distance; @@ -233,9 +231,7 @@ public class LocalisationMetrics { earthDistanceCount += earthDistance; // Compute remaining distance - double distance = DistanceTools.computeDistance(gpB.getLongitude(), gpB.getLatitude(), - gpA.getLongitude(), gpA.getLatitude(), - computeAngular); + double distance = DistanceTools.computeDistance(gpB, gpA, computeAngular); count += distance; if (distance > resMax) { resMax = distance; diff --git a/src/tutorials/java/fr/cs/examples/refiningPleiades/models/PleiadesViewingModel.java b/src/tutorials/java/fr/cs/examples/refiningPleiades/models/PleiadesViewingModel.java index c44d9b34daa231d94e9195d37ecd43b3331bf279..b54af4efbf63f95a651806c0a665687029bd7c8d 100644 --- a/src/tutorials/java/fr/cs/examples/refiningPleiades/models/PleiadesViewingModel.java +++ b/src/tutorials/java/fr/cs/examples/refiningPleiades/models/PleiadesViewingModel.java @@ -44,7 +44,7 @@ import org.orekit.errors.OrekitException; /** * Pleiades viewing model class definition. - * the aim of this class is to simulate PHR sensor. + * The aim of this class is to simulate PHR sensor. * @author Jonathan Guinet * @author Lucie Labat-Allee * @author Guylaine Prat @@ -92,7 +92,7 @@ public class PleiadesViewingModel { this.createLineSensor(); } - /** TODO GP add comments + /** Create raw fixed Line Of sight */ public LOSBuilder rawLOS(final Vector3D center, final Vector3D normal, final double halfAperture, final int n) { @@ -105,7 +105,7 @@ public class PleiadesViewingModel { return new LOSBuilder(list); } - /** TODO GP add comments + /** Build a LOS provider */ public TimeDependentLOS buildLOS() { @@ -124,7 +124,7 @@ public class PleiadesViewingModel { } - /** TODO GP add comments + /** Get the reference date. */ public AbsoluteDate getDatationReference() throws OrekitException { @@ -134,25 +134,25 @@ public class PleiadesViewingModel { return new AbsoluteDate(date, utc); } - /** TODO GP add comments + /** Get the min date. */ public AbsoluteDate getMinDate() throws RuggedException { return lineSensor.getDate(0); } - /** TODO GP add comments + /** Get the max date. */ public AbsoluteDate getMaxDate() throws RuggedException { return lineSensor.getDate(DIMENSION); } - /** TODO GP add comments + /** Get the line sensor. */ public LineSensor getLineSensor() { return lineSensor; } - /** TODO GP add comments + /** Get the sensor name. */ public String getSensorName() { return sensorName; @@ -165,7 +165,7 @@ public int getDimension() { return DIMENSION; } - /** TODO GP add comments + /** Create the line sensor */ private void createLineSensor() throws RuggedException, OrekitException { @@ -174,7 +174,6 @@ public int getDimension() { // los: swath in the (YZ) plane, looking at 50° roll, 2.6" per pixel final Vector3D msiOffset = new Vector3D(0, 0, 0); - // TODO build complex los final TimeDependentLOS lineOfSight = buildLOS(); final double rate = 1. / LINE_PERIOD;