From c062933c42ee943be644e68bb60fa7b59ae91efb Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 23 Jan 2019 16:00:57 +0100 Subject: [PATCH 1/2] fix secondorder mesh generation for closed occ edge --- libsrc/occ/occmeshsurf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libsrc/occ/occmeshsurf.cpp b/libsrc/occ/occmeshsurf.cpp index a1f60db6..13f034be 100644 --- a/libsrc/occ/occmeshsurf.cpp +++ b/libsrc/occ/occmeshsurf.cpp @@ -673,13 +673,13 @@ namespace netgen if (surfi > 0) { - double u = gi1.u+secpoint*(gi2.u-gi1.u); double v = gi1.v+secpoint*(gi2.v-gi1.v); - - if (!geometry.FastProject (surfi, hnewp, u, v)) + + if (!geometry.FastProject (surfi, hnewp, u, v) || Dist(hnewp, p1) > Dist(p1,p2)) { - // cout << "Fast projection to surface fails! Using OCC projection" << endl; + // cout << "Fast projection to surface fails! Using OCC projection" << endl; + hnewp = p1+secpoint*(p2-p1); geometry.Project (surfi, hnewp); } From fbd7d2340e861ee49e57469ca7a5ddc075f19dd6 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 23 Jan 2019 16:58:23 +0100 Subject: [PATCH 2/2] check dist to midpoint and save midpoint in PointBetween --- libsrc/occ/occmeshsurf.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsrc/occ/occmeshsurf.cpp b/libsrc/occ/occmeshsurf.cpp index 13f034be..56fbf07b 100644 --- a/libsrc/occ/occmeshsurf.cpp +++ b/libsrc/occ/occmeshsurf.cpp @@ -676,10 +676,11 @@ namespace netgen double u = gi1.u+secpoint*(gi2.u-gi1.u); double v = gi1.v+secpoint*(gi2.v-gi1.v); - if (!geometry.FastProject (surfi, hnewp, u, v) || Dist(hnewp, p1) > Dist(p1,p2)) + auto savept = hnewp; + if (!geometry.FastProject (surfi, hnewp, u, v) || Dist(hnewp, savept) > Dist(p1,p2)) { // cout << "Fast projection to surface fails! Using OCC projection" << endl; - hnewp = p1+secpoint*(p2-p1); + hnewp = savept; geometry.Project (surfi, hnewp); }