Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryObject.cs =================================================================== diff -u -r5064 -r5170 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryObject.cs (.../GeometryObject.cs) (revision 5064) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryObject.cs (.../GeometryObject.cs) (revision 5170) @@ -83,11 +83,12 @@ { return Name; } - + /// - /// Rounds given value to geometry accuracy + /// Rounds given value to given accuracy (by default the geometry accuracy is used) /// /// + /// /// - public double RoundValue(double originalValue) => Math.Round(originalValue / GeometryConstants.Accuracy) * GeometryConstants.Accuracy; + public double RoundValue(double originalValue, double accuracy = GeometryConstants.Accuracy) => Math.Round(originalValue / accuracy) * accuracy; } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs =================================================================== diff -u -r5069 -r5170 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 5069) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/Point2D.cs (.../Point2D.cs) (revision 5170) @@ -117,16 +117,17 @@ X = aPoint.X; Z = aPoint.Z; } - + /// - /// Rounds the value using the GeometryConstants.Accuracy + /// Rounds the value using the given accuracy (by default the GeometryConstants.Accuracy is used) /// /// + /// /// - public double RoundValue(double value) + public double RoundValue(double value, double accuracy = GeometryConstants.Accuracy) { - var res = Math.Round(value / GeometryConstants.Accuracy); - return res * GeometryConstants.Accuracy; + double res = Math.Round(value / accuracy); + return res * accuracy; } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs =================================================================== diff -u -r5069 -r5170 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs (.../GeometryPointString.cs) (revision 5069) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geometry/GeometryPointString.cs (.../GeometryPointString.cs) (revision 5170) @@ -179,7 +179,7 @@ public virtual GeometryPointString Clone() { var clone = new GeometryPointString(); - this.CloneProperties(clone); // exludes the points ! + this.CloneProperties(clone); // excludes the points ! clone.Points.Clear(); foreach (GeometryPoint point in Points) { @@ -191,14 +191,14 @@ } /// - /// Round all points to the nearest geometry accuracy + /// Round all points to the nearest given accuracy /// - public void RoundPointsCoordinates() + public void RoundPointsCoordinates(double accuracy) { foreach (GeometryPoint point in (IEnumerable) this.Points) { - point.X = RoundValue(point.X); - point.Z = RoundValue(point.Z); + point.X = RoundValue(point.X, accuracy); + point.Z = RoundValue(point.Z, accuracy); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs =================================================================== diff -u -r5157 -r5170 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 5157) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile2DSurfaceLineHelper.cs (.../SoilProfile2DSurfaceLineHelper.cs) (revision 5170) @@ -133,16 +133,17 @@ private static void RoundCoordinates(GeometryPointString surfaceLine, SoilProfile2D soilProfile2D) { + const double accuracy = 1e-7; foreach (Point2D point in soilProfile2D.Geometry.Points) { - point.X = point.RoundValue(point.X); - point.Z = point.RoundValue(point.Z); + point.X = point.RoundValue(point.X, accuracy); + point.Z = point.RoundValue(point.Z, accuracy); } - soilProfile2D.Geometry.Right = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Right); - soilProfile2D.Geometry.Left = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Left); - soilProfile2D.Geometry.Bottom = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Bottom); - surfaceLine.RoundPointsCoordinates(); + soilProfile2D.Geometry.Right = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Right, accuracy); + soilProfile2D.Geometry.Left = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Left, accuracy); + soilProfile2D.Geometry.Bottom = soilProfile2D.Geometry.RoundValue(soilProfile2D.Geometry.Bottom, accuracy); + surfaceLine.RoundPointsCoordinates(accuracy); } private static void AddGeometryIntersectionsToSurfaceLine(GeometryData geometry, ref GeometryPointString cloneSurfaceline) {