Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r619da07034480d4ba9e59fe0bea2dd06d83963e0 -rfd3f53993a2113c76da7d305a0e80621605bfe3f --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 619da07034480d4ba9e59fe0bea2dd06d83963e0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision fd3f53993a2113c76da7d305a0e80621605bfe3f) @@ -268,7 +268,7 @@ } var segments = new Collection(); - for (int i = 1; i < localGeometry.Length; i++) + for (int i = 1; i < LocalGeometry.Length; i++) { segments.Add(new Segment2D(LocalGeometry[i - 1], LocalGeometry[i])); } @@ -329,6 +329,29 @@ return !(firstLocalPoint.X > roundedLocalCoordinateL) && !(lastLocalPoint.X < roundedLocalCoordinateL); } + /// + /// Gets the local coordinate with rounded values based on the geometry of the surface line and the given world coordinate. + /// + /// The world coordinate to get the local coordinate for. + /// The local coordinate. + public Point2D GetLocalPointFromGeometry(Point3D worldCoordinate) + { + var count = Points.Length; + if (count <= 1) + { + return new Point2D(double.NaN, double.NaN); + } + + Point3D first = Points.First(); + Point3D last = Points.Last(); + Point2D firstPoint = new Point2D(first.X, first.Y); + Point2D lastPoint = new Point2D(last.X, last.Y); + + Point2D localCoordinate = worldCoordinate.ProjectIntoLocalCoordinates(firstPoint, lastPoint); + return new Point2D(new RoundedDouble(numberOfDecimalPlaces, localCoordinate.X), + new RoundedDouble(numberOfDecimalPlaces, localCoordinate.Y)); + } + public override string ToString() { return Name;