Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r5773 -r5784 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5773) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 5784) @@ -1063,7 +1063,7 @@ Gauge gauge = (gauges.Where(x => x.Name == gaugePlLinePoint.GaugeIDZ && x.Location == location)).FirstOrDefault(); if (gauge != null) { - if (!gauge.Value.HasValue || Math.Abs((double) (gauge.Value - GaugeMissVal)) < toleranceAlmostEqual) + if (!gauge.Value.HasValue || ((double) gauge.Value).IsNearEqual(GaugeMissVal, toleranceAlmostEqual)) { throw new PlLinesCreatorException($"Value of gauge {gauge.Name} at location {location.Name} in gauge PL line of type {gaugePlLine.PlLineType.ToString()} is undefined."); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs =================================================================== diff -u -r5773 -r5784 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 5773) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/SurfaceLineAdapter.cs (.../SurfaceLineAdapter.cs) (revision 5784) @@ -26,6 +26,8 @@ using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard; +using MathNet.Numerics; namespace Deltares.DamEngine.Calculators.DikesDesign; @@ -144,8 +146,8 @@ { newSlopeEndPoint = intersectionpoints.First(); // One of the intersection points can be the dike top which should not be replaced - if (Math.Abs(newSlopeEndPoint.X - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X) < GeometryConstants.Tolerance && - Math.Abs(newSlopeEndPoint.Z - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z) < GeometryConstants.Tolerance ) + if (newSlopeEndPoint.X.IsNearEqual(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, GeometryConstants.Tolerance) && + newSlopeEndPoint.Z.IsNearEqual(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, GeometryConstants.Tolerance)) { newSlopeEndPoint = null; if (intersectionpoints.Count > 1) @@ -324,12 +326,11 @@ // TODO: #the Following code is not correct; you should also look at the setting of Location.UseNewMinDistanceDikeToeStartDitch // First determine all coordinates - if (distanceToNewToe < Location.NewMinDistanceDikeToeStartDitch && - Math.Abs(distanceToNewToe - ditchDefinition.Value.DistanceFromToe) > GeometryConstants.Tolerance ) + if (distanceToNewToe.IsSmaller(Location.NewMinDistanceDikeToeStartDitch, GeometryConstants.Tolerance) && + !distanceToNewToe.IsNearEqual(ditchDefinition.Value.DistanceFromToe, GeometryConstants.Tolerance)) { // Ditch needs to be moved as it is less then the minimum required distance from the new toe - xDitchDikeSide = dikeToeAtPolder.X + - Location.NewMinDistanceDikeToeStartDitch; + xDitchDikeSide = dikeToeAtPolder.X + Location.NewMinDistanceDikeToeStartDitch; if (Location.UseNewDitchDefinition) { // Use the new definition instead of the old shape Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs =================================================================== diff -u -r5773 -r5784 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 5773) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Uplift/UpliftLocationDeterminator.cs (.../UpliftLocationDeterminator.cs) (revision 5784) @@ -26,6 +26,7 @@ using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard; namespace Deltares.DamEngine.Calculators.Uplift; @@ -166,8 +167,8 @@ } } - if ((Math.Abs(upliftFactorForBottomSandLayer - double.MaxValue) < toleranceAlmostEqual) && - (Math.Abs(upliftFactorForInBetweenSandLayer - double.MaxValue) < toleranceAlmostEqual)) + if (upliftFactorForBottomSandLayer.IsNearEqual(double.MaxValue, toleranceAlmostEqual) && + upliftFactorForInBetweenSandLayer.IsNearEqual(double.MaxValue, toleranceAlmostEqual)) { return null; }