Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs =================================================================== diff -u -r6559 -r6560 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs (.../GeometrySurface.cs) (revision 6559) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometrySurface.cs (.../GeometrySurface.cs) (revision 6560) @@ -175,11 +175,13 @@ /// The point or null when no valid point is found. public Point2D DetermineValidTestPointBasedOnNewSurface() { - double offset = 0.002; + const double initialOffset = 0.002; + const double stopCriteriumOffset = 1e-8; + double offset = initialOffset; Point2D point = null; var geometryPointString = DetermineTopGeometrySurface(); geometryPointString.SortPointsByXAscending(); - while (point == null && offset > 1e-8) + while (point == null && offset > stopCriteriumOffset) { // Just keep looking by halving the offset until found. point = FindValidTestPoint(geometryPointString, offset); @@ -214,8 +216,8 @@ } if (i == geometryPointString.Count - 2) { - // if no valid point is found, then the shape is very awkward or the surface is terribly small. - // In that case, return null. + // if no valid point is yet found, then the shape is very awkward or the surface is terribly small. + // In that case, return null so the routine can try again with a smaller offset. point = null; } }