From 93294b2d44d88a3a19bb808646499d7dbd25067f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 23 Oct 2023 16:14:43 +0200 Subject: [PATCH] for line intersection, exclude the end point of the intersected line. This is needed to make Build's utilities work as expected. --- source/common/utility/geometry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/utility/geometry.h b/source/common/utility/geometry.h index cbe0fc72d..3a7bb8d9c 100644 --- a/source/common/utility/geometry.h +++ b/source/common/utility/geometry.h @@ -150,7 +150,7 @@ inline double InterceptLineSegments(double v2x, double v2y, double v2dx, double den = 1 / den; double factor1 = ((v2x - v1x) * v2dy + (v1y - v2y) * v2dx) * -den; - if (factor1 < 0 || factor1 > 1) return -FLT_MAX; // no intersection + if (factor1 < 0 || factor1 >= 1) return -FLT_MAX; // no intersection if (pfactor1) *pfactor1 = factor1; return ((v1x - v2x) * v1dy + (v2y - v1y) * v1dx) * den; // this one's for the line segment where we want to get the intercept factor for so it needs to be last.