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