Skip to content
Snippets Groups Projects
Commit fc95ed7b authored by Guylaine Prat's avatar Guylaine Prat
Browse files

Checkstyle corrections

parent ade02e21
No related branches found
No related tags found
No related merge requests found
...@@ -175,58 +175,57 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm { ...@@ -175,58 +175,57 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
NormalizedGeodeticPoint currentGuess = closeGuess; NormalizedGeodeticPoint currentGuess = closeGuess;
NormalizedGeodeticPoint foundIntersection = null; NormalizedGeodeticPoint foundIntersection = null;
if (flatBody) {
if (flatBody) { // under the (bad) flat-body assumption, the reference point must remain
// under the (bad) flat-body assumption, the reference point must remain // at DEM entry and exit, even if we already have a much better close guess :-(
// at DEM entry and exit, even if we already have a much better close guess :-( // this is in order to remain consistent with other systems
// this is in order to remain consistent with other systems final Tile tile = cache.getTile(currentGuess.getLatitude(), currentGuess.getLongitude());
final Tile tile = cache.getTile(currentGuess.getLatitude(), currentGuess.getLongitude()); final Vector3D exitP = ellipsoid.pointAtAltitude(position, los, tile.getMinElevation());
final Vector3D exitP = ellipsoid.pointAtAltitude(position, los, tile.getMinElevation()); final Vector3D entryP = ellipsoid.pointAtAltitude(position, los, tile.getMaxElevation());
final Vector3D entryP = ellipsoid.pointAtAltitude(position, los, tile.getMaxElevation()); final NormalizedGeodeticPoint entry = ellipsoid.transform(entryP, ellipsoid.getBodyFrame(), null,
final NormalizedGeodeticPoint entry = ellipsoid.transform(entryP, ellipsoid.getBodyFrame(), null, tile.getMinimumLongitude());
tile.getMinimumLongitude()); foundIntersection = tile.cellIntersection(entry, ellipsoid.convertLos(entryP, exitP),
foundIntersection = tile.cellIntersection(entry, ellipsoid.convertLos(entryP, exitP), tile.getFloorLatitudeIndex(currentGuess.getLatitude()),
tile.getFloorLatitudeIndex(currentGuess.getLatitude()), tile.getFloorLongitudeIndex(currentGuess.getLongitude()));
tile.getFloorLongitudeIndex(currentGuess.getLongitude()));
} else { // with a DEM
} else { // with a DEM
while (foundIntersection == null && (nbCall < NB_TIME_CELL_INTERSECTION)) {
while (foundIntersection == null && (nbCall < NB_TIME_CELL_INTERSECTION)) {
final Vector3D delta = ellipsoid.transform(currentGuess).subtract(position);
final Vector3D delta = ellipsoid.transform(currentGuess).subtract(position); final double s = Vector3D.dotProduct(delta, los) / los.getNormSq();
final double s = Vector3D.dotProduct(delta, los) / los.getNormSq(); final GeodeticPoint projected = ellipsoid.transform(new Vector3D(1, position, s, los),
final GeodeticPoint projected = ellipsoid.transform(new Vector3D(1, position, s, los), ellipsoid.getBodyFrame(), null);
ellipsoid.getBodyFrame(), null); final NormalizedGeodeticPoint normalizedProjected =
final NormalizedGeodeticPoint normalizedProjected = new NormalizedGeodeticPoint(projected.getLatitude(),
new NormalizedGeodeticPoint(projected.getLatitude(), projected.getLongitude(),
projected.getLongitude(), projected.getAltitude(),
projected.getAltitude(), currentGuess.getLongitude());
currentGuess.getLongitude()); final Tile tile = cache.getTile(normalizedProjected.getLatitude(), normalizedProjected.getLongitude());
final Tile tile = cache.getTile(normalizedProjected.getLatitude(), normalizedProjected.getLongitude());
foundIntersection = tile.cellIntersection(normalizedProjected,
foundIntersection = tile.cellIntersection(normalizedProjected, ellipsoid.convertLos(normalizedProjected, los),
ellipsoid.convertLos(normalizedProjected, los), tile.getFloorLatitudeIndex(normalizedProjected.getLatitude()),
tile.getFloorLatitudeIndex(normalizedProjected.getLatitude()), tile.getFloorLongitudeIndex(normalizedProjected.getLongitude()));
tile.getFloorLongitudeIndex(normalizedProjected.getLongitude()));
// For extremely rare case : the cell intersection gave no results ...
// For extremely rare case : the cell intersection gave no results ... // We use as a new guess a slightly modified projected geodetic point (which is on the LOS line)
// We use as a new guess a slightly modified projected geodetic point (which is on the LOS line) if (foundIntersection == null) {
if (foundIntersection == null) { final double shiftedS = s - 1;
double shiftedS = s - 1; final GeodeticPoint currentGuessGP = ellipsoid.transform(new Vector3D(1, position, shiftedS, los),
GeodeticPoint currentGuessGP = ellipsoid.transform(new Vector3D(1, position, shiftedS, los), ellipsoid.getBodyFrame(), null);
ellipsoid.getBodyFrame(), null); currentGuess = new NormalizedGeodeticPoint(currentGuessGP.getLatitude(),
currentGuess = new NormalizedGeodeticPoint(currentGuessGP.getLatitude(), currentGuessGP.getLongitude(),
currentGuessGP.getLongitude(), currentGuessGP.getAltitude(),
currentGuessGP.getAltitude(), projected.getLongitude());
projected.getLongitude()); // to avoid infinite loop ...
// to avoid infinite loop ... nbCall++;
nbCall++; }
} } // end while foundIntersection = null
} // end while foundIntersection = null } // end test on flatbody
} // end test on flatbody
return foundIntersection;
return foundIntersection;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
......
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