Skip to content

Commit

Permalink
for line intersection, exclude the end point of the intersected line.
Browse files Browse the repository at this point in the history
This is needed to make Build's utilities work as expected.
  • Loading branch information
coelckers committed Oct 23, 2023
1 parent 66db6c5 commit e7b67e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/common/utility/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e7b67e2

Please sign in to comment.