Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Helpers/ExportableFailureMechanismSectionHelper.cs =================================================================== diff -u -rc6abf7f3537baaba6e7a6108d115a0c27fd7f4a0 -r83d814cc1cd1d6944d065ed27f54b459c729199b --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Helpers/ExportableFailureMechanismSectionHelper.cs (.../ExportableFailureMechanismSectionHelper.cs) (revision c6abf7f3537baaba6e7a6108d115a0c27fd7f4a0) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Helpers/ExportableFailureMechanismSectionHelper.cs (.../ExportableFailureMechanismSectionHelper.cs) (revision 83d814cc1cd1d6944d065ed27f54b459c729199b) @@ -68,6 +68,15 @@ return failureMechanismSectionsLookup; } + /// + /// Gets the geometry of a failure mechanism section based on the geometry + /// of the , and . + /// + /// The reference line to get the geometry from. + /// The start of the section from the beginning of the reference line in meters. + /// The end of the section from the beginning of the reference line in meters. + /// A geometry based on the reference line and the section start and end. + /// Thrown when is null. public static IEnumerable GetFailureMechanismSectionGeometry(ReferenceLine referenceLine, int sectionStart, int sectionEnd) { if (referenceLine == null) @@ -157,10 +166,11 @@ return startPoint; } - private static Point2D InterpolatePoint(Point2D a, Point2D b, double distance) + private static Point2D InterpolatePoint(Point2D startPoint, Point2D endPoint, double distance) { - double magnitude = Math.Sqrt(Math.Pow(b.Y - a.Y, 2) + Math.Pow(b.X - a.X, 2)); - return new Point2D(a.X + (distance * ((b.X - a.X) / magnitude)), a.Y + (distance * ((b.Y - a.Y) / magnitude))); + double magnitude = Math.Sqrt(Math.Pow(endPoint.Y - startPoint.Y, 2) + Math.Pow(endPoint.X - startPoint.X, 2)); + return new Point2D(startPoint.X + (distance * ((endPoint.X - startPoint.X) / magnitude)), + startPoint.Y + (distance * ((endPoint.Y - startPoint.Y) / magnitude))); } } } \ No newline at end of file