From 48eb4fed07c9bf72d14dae93963d249785da413f Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 10 Jan 2024 16:31:05 +0100 Subject: [PATCH] add tolerance to occ-edge projection --- libsrc/occ/occ_edge.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/occ_edge.cpp b/libsrc/occ/occ_edge.cpp index 0c907d78..4805bb17 100644 --- a/libsrc/occ/occ_edge.cpp +++ b/libsrc/occ/occ_edge.cpp @@ -61,7 +61,12 @@ namespace netgen void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const { auto pnt = ng2occ(p); - GeomAPI_ProjectPointOnCurve proj(pnt, curve, s0, s1); + // extend the projection parameter range, else projection might fail + // for an endpoint + // see discussion here: https://forum.ngsolve.org/t/how-to-apply-occidentification-correctly/2555 + // I do not see a better way using occ tolerances? + double eps = 1e-7 * (s1-s0); + GeomAPI_ProjectPointOnCurve proj(pnt, curve, s0-eps, s1+eps); pnt = proj.NearestPoint(); if(gi) gi->dist = (proj.LowerDistanceParameter() - s0)/(s1-s0);