From 17b38322979311cb2f18896cf8ea06b1ce63aebb Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 5 Oct 2023 23:55:51 +0900 Subject: [PATCH] fix: Possible loss of precision while rounding values --- src/DotRecast.Detour.Extras/DtPolyUtils.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DotRecast.Detour.Extras/DtPolyUtils.cs b/src/DotRecast.Detour.Extras/DtPolyUtils.cs index 53b581b..5f11915 100644 --- a/src/DotRecast.Detour.Extras/DtPolyUtils.cs +++ b/src/DotRecast.Detour.Extras/DtPolyUtils.cs @@ -16,6 +16,8 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; + namespace DotRecast.Detour.Extras { public static class DtPolyUtils @@ -62,7 +64,7 @@ namespace DotRecast.Detour.Extras { for (int i = 0; i < 3; i++) { - if (verts[3 * v + i] != verts2[3 * v2 + 1]) + if (Math.Abs(verts[3 * v + i] - verts2[3 * v2 + 1]) > float.Epsilon) { return false; }