Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit c197216a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

vectomath: if start and end point are the same and equal the interpolated...

vectomath: if start and end point are the same and equal the interpolated point just return the according value
parent 9fe62ace
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment