From 05f770cc7c00d6e72fbcbc5c6d0c118e97466366 Mon Sep 17 00:00:00 2001 From: Guylaine Prat <guylaine.prat@c-s.fr> Date: Wed, 13 Feb 2019 15:42:03 +0100 Subject: [PATCH] Reset properly the number of calls in case of second try Issue #376 --- .../intersection/duvenhage/DuvenhageAlgorithm.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java b/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java index 1b14cd22..70096451 100644 --- a/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java +++ b/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java @@ -54,9 +54,6 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm { /** Flag for flat-body hypothesis. */ private final boolean flatBody; - /** Nb times cell intersection (with DEM) is performed for null intersection (used to avoid infinite loop). */ - private int nbCall = 0; - /** Simple constructor. * @param updater updater used to load Digital Elevation Model tiles * @param maxCachedTiles maximum number of tiles stored in the cache @@ -191,8 +188,14 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm { } else { // with a DEM - final NormalizedGeodeticPoint currentGuess0 = currentGuess; + // Keep the initial guess + final NormalizedGeodeticPoint currentGuess0 = closeGuess; + + // number of times cell intersection (with DEM) is performed for null intersection (used to avoid infinite loop) + int nbCall = 0; + // Shift for s to find the solution if foundIntersection is null double deltaS = -1.; + // if the shifts in one way was not successful, try the other way boolean secondChance = false; while (foundIntersection == null && (nbCall < NB_TIME_CELL_INTERSECTION)) { -- GitLab