fix: 射线原点微偏移避免面上歧义
CI / Build & Test (push) Failing after 36s
CI / Release Build (push) Failing after 43s

This commit is contained in:
茂之钳
2026-07-23 15:43:53 +00:00
parent f1d144aaa0
commit 78995ecf6a
+4 -2
View File
@@ -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);