From 8e9c308afd0fc6f7b8d8a76dbb8f905e41cb1425 Mon Sep 17 00:00:00 2001 From: Graham Pentheny Date: Mon, 20 Mar 2023 01:03:27 -0400 Subject: [PATCH] Increase epsilon in detour common segment polygon intersection test (#612) It's only used to detect if the segment is parallel to the polygon edge in question, and if so, skip actually doing the intersection test. This sets the epsilon to 1e-6, which is about 10x the machine epsilon for 32bit floats, so it's low enough to not give false positives but it's large enough to correctly detect segments and polygon edges that are very nearly parallel. --- Detour/Source/DetourCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detour/Source/DetourCommon.cpp b/Detour/Source/DetourCommon.cpp index b89d751..b845782 100644 --- a/Detour/Source/DetourCommon.cpp +++ b/Detour/Source/DetourCommon.cpp @@ -112,7 +112,7 @@ bool dtIntersectSegmentPoly2D(const float* p0, const float* p1, float& tmin, float& tmax, int& segMin, int& segMax) { - static const float EPS = 0.00000001f; + static const float EPS = 0.000001f; tmin = 0; tmax = 1;