From 0c686e6b8b018726e314baff0a5925a2d1df8fa1 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Fri, 17 Sep 2021 11:22:37 +0200 Subject: [PATCH] if PointBetweenEdge gets invalid edgenr, return midpoint This is needed for creating boundarylayers and then curving the mesh. --- libsrc/occ/occgeom.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 480bcc7d..56cfe6fd 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1442,12 +1442,13 @@ namespace netgen { double s0, s1; - Point<3> hnewp = p1+secpoint*(p2-p1); - gp_Pnt pnt(hnewp(0), hnewp(1), hnewp(2)); + newp = p1+secpoint*(p2-p1); + if(ap1.edgenr > emap.Size() || ap1.edgenr == 0) + return; + gp_Pnt pnt(newp(0), newp(1), newp(2)); GeomAPI_ProjectPointOnCurve proj(pnt, BRep_Tool::Curve(TopoDS::Edge(emap(ap1.edgenr)), s0, s1)); pnt = proj.NearestPoint(); - hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z()); - newp = hnewp; + newp = Point<3> (pnt.X(), pnt.Y(), pnt.Z()); newgi = ap1; };