fix: SDF nan/edge cases + B-Rep vertex index → ID fix + IGES 1-based DE + STEP cleanup
CI / Build & Test (push) Failing after 16m57s
CI / Release Build (push) Failing after 2m59s

This commit is contained in:
茂之钳
2026-07-24 08:42:53 +00:00
parent ebc47a25c9
commit a323776fd3
12 changed files with 139 additions and 70 deletions
+10 -1
View File
@@ -46,7 +46,12 @@ using core::Vector3D;
[[nodiscard]] inline double capsule(const Point3D& p, const Point3D& a, const Point3D& b, double radius) {
Point3D pa = p - a;
Point3D ba = b - a;
double h = std::clamp(pa.dot(ba) / ba.squaredNorm(), 0.0, 1.0);
double ba_sq = ba.squaredNorm();
if (ba_sq < 1e-30) {
// Degenerate to sphere
return pa.norm() - radius;
}
double h = std::clamp(pa.dot(ba) / ba_sq, 0.0, 1.0);
return (pa - ba * h).norm() - radius;
}
@@ -75,6 +80,10 @@ using core::Vector3D;
double k1 = Point3D(p.x() / (radii.x() * radii.x()),
p.y() / (radii.y() * radii.y()),
p.z() / (radii.z() * radii.z())).norm();
if (k1 < 1e-30) {
// Degenerate: point at origin → distance = -min(radii)
return -std::min({radii.x(), radii.y(), radii.z()});
}
return k0 * (k0 - 1.0) / k1;
}