From c197216ad4830c7d54347dfcd49a3ab949e0dbf2 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Tue, 22 Jan 2019 18:01:54 +0100
Subject: [PATCH] vectomath: if start and end point are the same and equal the
 interpolated point just return the according value

---
 VectoCommon/VectoCommon/Utils/VectoMath.cs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/VectoCommon/VectoCommon/Utils/VectoMath.cs b/VectoCommon/VectoCommon/Utils/VectoMath.cs
index df6a72477e..13dbec791c 100644
--- a/VectoCommon/VectoCommon/Utils/VectoMath.cs
+++ b/VectoCommon/VectoCommon/Utils/VectoMath.cs
@@ -134,6 +134,9 @@ namespace TUGraz.VectoCommon.Utils
 		[MethodImpl(MethodImplOptions.AggressiveInlining)]
 		public static double Interpolate(double x1, double x2, double y1, double y2, double xint)
 		{
+			if ((x1 - x2).IsEqual(0, 1e-9) && (x1 - xint).IsEqual(0, 1e-9)) {
+				return y1;
+			}
 			return (xint - x1) * (y2 - y1) / (x2 - x1) + y1;
 		}
 
-- 
GitLab