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

Fixe an infinite loop problem in rare cases.

parent 051b0b1c
No related branches found
No related tags found
No related merge requests found
......@@ -246,9 +246,10 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
return null;
}
NormalizedGeodeticPoint previousGP = entry;
int previousLat = entryLat;
int previousLon = entryLon;
NormalizedGeodeticPoint previousGP = entry;
int previousLat = entryLat;
int previousLon = entryLon;
final double angularMargin = STEP / ellipsoid.getEquatorialRadius();
// introduce all intermediate points corresponding to the line-of-sight
// intersecting the boundary between level 0 sub-tiles
......@@ -260,8 +261,8 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
// compute segment endpoints
final double longitude = tile.getLongitudeAtIndex(crossingLon);
if (longitude >= FastMath.min(entry.getLongitude(), exit.getLongitude()) &&
longitude <= FastMath.max(entry.getLongitude(), exit.getLongitude())) {
if (longitude >= FastMath.min(entry.getLongitude(), exit.getLongitude()) - angularMargin &&
longitude <= FastMath.max(entry.getLongitude(), exit.getLongitude()) + angularMargin) {
NormalizedGeodeticPoint crossingGP = null;
if (!flatBody) {
......@@ -317,8 +318,8 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
// compute segment endpoints
final double latitude = tile.getLatitudeAtIndex(crossingLat);
if (latitude >= FastMath.min(entry.getLatitude(), exit.getLatitude()) &&
latitude <= FastMath.max(entry.getLatitude(), exit.getLatitude())) {
if (latitude >= FastMath.min(entry.getLatitude(), exit.getLatitude()) - angularMargin &&
latitude <= FastMath.max(entry.getLatitude(), exit.getLatitude()) + angularMargin) {
NormalizedGeodeticPoint crossingGP = null;
if (!flatBody) {
......
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