Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -rb8976a5e3cf525e419227e409e44ac69a430711a --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision b8976a5e3cf525e419227e409e44ac69a430711a) @@ -39,7 +39,7 @@ public class RingtoetsPipingSurfaceLine : Observable, IMechanismSurfaceLine { private const int numberOfDecimalPlaces = 2; - private Point2D[] localGeometry; + private RoundedPoint2DCollection localGeometry; /// /// Initializes a new instance of the class. @@ -48,7 +48,7 @@ { Name = string.Empty; Points = new Point3D[0]; - localGeometry = new Point2D[0]; + localGeometry = new RoundedPoint2DCollection(2, new Point2D[0]); } /// @@ -109,7 +109,7 @@ /// /// Gets the 2D points describing the local geometry of the surface line. /// - public IEnumerable LocalGeometry + public RoundedPoint2DCollection LocalGeometry { get { @@ -141,7 +141,7 @@ EndingWorldPoint = Points[Points.Length - 1]; } - localGeometry = ProjectGeometryToLZ().ToArray(); + localGeometry = new RoundedPoint2DCollection(numberOfDecimalPlaces, Points.ProjectToLZ().ToArray()); } /// @@ -269,9 +269,9 @@ } var segments = new Collection(); - for (var i = 1; i < localGeometry.Length; i++) + for (var i = 1; i < localGeometry.Count(); i++) { - segments.Add(new Segment2D(localGeometry[i - 1], localGeometry[i])); + segments.Add(new Segment2D(localGeometry.ElementAt(i - 1), localGeometry.ElementAt(i))); } IEnumerable intersectionPoints = Math2D.SegmentsIntersectionWithVerticalLine(segments, l).OrderBy(p => p.Y).ToArray(); @@ -289,34 +289,6 @@ } /// - /// Projects the points in to localized coordinate (LZ-plane) system. - /// Z-values are retained, and the first point is put a L=0. - /// - /// Collection of 2D points in the LZ-plane. - public RoundedPoint2DCollection ProjectGeometryToLZ() - { - int count = Points.Length; - if (count == 0) - { - return new RoundedPoint2DCollection(numberOfDecimalPlaces, Enumerable.Empty()); - } - - Point3D first = Points.First(); - if (count == 1) - { - return new RoundedPoint2DCollection(numberOfDecimalPlaces, new[] - { - new Point2D(0.0, first.Z) - }); - } - - Point3D last = Points.Last(); - var firstPoint = new Point2D(first.X, first.Y); - var lastPoint = new Point2D(last.X, last.Y); - return new RoundedPoint2DCollection(numberOfDecimalPlaces, Points.Select(p => p.ProjectIntoLocalCoordinates(firstPoint, lastPoint))); - } - - /// /// Checks whether is in range of the geometry projected in local coordinate system /// where the points are ordered on the L-coordinate being monotonically non-decreasing. ///