From 78995ecf6a0dc195d4532054bb21c554285c29f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=82=E4=B9=8B=E9=92=B3?= Date: Thu, 23 Jul 2026 15:43:53 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=84=E7=BA=BF=E5=8E=9F=E7=82=B9?= =?UTF-8?q?=E5=BE=AE=E5=81=8F=E7=A7=BB=E9=81=BF=E5=85=8D=E9=9D=A2=E4=B8=8A?= =?UTF-8?q?=E6=AD=A7=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/boolean/boolean_mesh.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/boolean/boolean_mesh.cpp b/src/boolean/boolean_mesh.cpp index 51089ab..dfc6d28 100644 --- a/src/boolean/boolean_mesh.cpp +++ b/src/boolean/boolean_mesh.cpp @@ -86,7 +86,9 @@ bool is_point_inside_bvh(const core::Point3D& p, core::Vector3D dir(1.0, 0.371, 0.539); dir.normalize(); - Ray3Dd ray(p, dir); + // Offset origin slightly to avoid exactly-on-face ambiguity + core::Point3D origin = p + dir * 1e-6; + Ray3Dd ray(origin, dir); auto results = bvh.query_ray(ray); int hits = 0; for (const auto& tri : results) { @@ -96,7 +98,7 @@ bool is_point_inside_bvh(const core::Point3D& p, double a = e1.dot(h); if (std::abs(a) < 1e-12) continue; double f = 1.0 / a; - core::Vector3D s = p - tri.v(0); + core::Vector3D s = origin - tri.v(0); double u = f * s.dot(h); if (u < 0.0 || u > 1.0) continue; core::Vector3D q = s.cross(e1);