Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs
===================================================================
diff -u -r4540 -r5018
--- DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs (.../ComputeDoubles.cs) (revision 4540)
+++ DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ComputeDoubles.cs (.../ComputeDoubles.cs) (revision 5018)
@@ -44,9 +44,9 @@
/// another value.
///
/// Uses a tolerance of 1e-3.
- public static bool IsGreaterThanOrEqualTo(this double aValue1, double aValue2)
+ public static bool IsGreaterThanOrEqualTo(this double aValue1, double aValue2, double tolerance = cEpsilon)
{
- if (aValue1 - aValue2 > -cEpsilon)
+ if (aValue1 - aValue2 > -tolerance)
{
return true;
}
@@ -58,7 +58,7 @@
/// Determines whether a value is significantly less than another value.
///
/// Uses a tolerance of 1e-3.
- public static bool IsLessThan(this double aValue1, double aValue2)
+ public static bool IsLessThan(this double aValue1, double aValue2, double tolerance = cEpsilon)
{
return !IsGreaterThanOrEqualTo(aValue1, aValue2);
}
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs
===================================================================
diff -u -r5010 -r5018
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5010)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 5018)
@@ -34,6 +34,7 @@
using Deltares.DamEngine.Data.General.Results;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Data.Standard;
using Deltares.DamEngine.Data.Standard.Calculation;
using Deltares.DamEngine.Data.Standard.Language;
using Deltares.DamEngine.Data.Standard.Logging;
@@ -438,24 +439,25 @@
private static void FitSoilProfile2DToSurfaceLine(SoilGeometryProbability subSoilScenario, SurfaceLine2 surfaceLine2)
{
+ const double tolerance = 1e-7;
double surfaceLine2LeftX = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X;
- if (surfaceLine2LeftX > subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Left)
+ if (subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Left.IsLessThan(surfaceLine2LeftX, tolerance))
{
GeometryHelper.CutGeometryLeft(subSoilScenario.SoilProfile2D.Geometry, surfaceLine2LeftX);
}
- if (surfaceLine2LeftX < subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Left)
+ if (surfaceLine2LeftX.IsLessThan(subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Left, tolerance))
{
GeometryHelper.ExtendGeometryLeft(subSoilScenario.SoilProfile2D.Geometry, surfaceLine2LeftX);
}
-
+
double surfaceLine2RightX = surfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X;
- if (surfaceLine2RightX > subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Right)
+ if (subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Right.IsLessThan(surfaceLine2RightX, tolerance))
{
GeometryHelper.ExtendGeometryRight(subSoilScenario.SoilProfile2D.Geometry, surfaceLine2RightX);
}
-
- if (surfaceLine2RightX < subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Right)
+
+ if (surfaceLine2RightX.IsLessThan(subSoilScenario.SoilProfile2D.Geometry.GetGeometryBounds().Right, tolerance))
{
GeometryHelper.CutGeometryRight(subSoilScenario.SoilProfile2D.Geometry, surfaceLine2RightX);
}