diff --git a/libsrc/meshing/adfront3.cpp b/libsrc/meshing/adfront3.cpp index df77fdde..31370930 100644 --- a/libsrc/meshing/adfront3.cpp +++ b/libsrc/meshing/adfront3.cpp @@ -787,6 +787,54 @@ void AdFront3 :: SetStartFront (int /* baseelnp */) */ } +bool AdFront3 :: PointInsideGroup(const NgArray &grouppindex, + const NgArray &groupfaces) const +{ + for(auto pi : Range(points)) + { + const auto& p = points[pi].P(); + bool found = false; + for(const auto& f : groupfaces) + { + for(auto i : Range(3)) + if(grouppindex.Get(f.PNum(i+1)) == pi) + { + found = true; + break; + } + } + if(found) + continue; + + // "random" direction + Vec<3> dir = { 0.123871, 0.15432,-0.43989 }; + DenseMatrix a(3), ainv(3); + Vector b(3), u(3); + + int count = 0; + for(const auto& f : groupfaces) + { + const auto& p1 = points[grouppindex.Get(f.PNum(1))].P(); + auto v1 = points[grouppindex.Get(f.PNum(2))].P() - p1; + auto v2 = points[grouppindex.Get(f.PNum(3))].P() - p1; + for(auto i : Range(3)) + { + a(i,0) = v1[i]; + a(i,1) = v2[i]; + a(i,2) = -dir[i]; + b(i) = p[i] - p1[i]; + } + CalcInverse (a, ainv); + ainv.Mult (b, u); + if (u(0) >= 0 && u(1) >= 0 && u(0)+u(1) <= 1 && + u(2) > 0) + count++; + } + if (count % 2 == 1) + return true; + } + return false; +} bool AdFront3 :: Inside (const Point<3> & p) const { diff --git a/libsrc/meshing/adfront3.hpp b/libsrc/meshing/adfront3.hpp index 859a8b42..2e209d4a 100644 --- a/libsrc/meshing/adfront3.hpp +++ b/libsrc/meshing/adfront3.hpp @@ -262,6 +262,9 @@ public: void GetIntersectingFaces (const Point<3> & pmin, const Point<3> & pmax, NgArray & ifaces) const; + bool PointInsideGroup(const NgArray &grouppindex, + const NgArray& groupfaces) const; + /// void GetFaceBoundingBox (int i, Box3d & box) const; diff --git a/libsrc/meshing/meshing3.cpp b/libsrc/meshing/meshing3.cpp index 646478d8..35197cfd 100644 --- a/libsrc/meshing/meshing3.cpp +++ b/libsrc/meshing/meshing3.cpp @@ -372,7 +372,8 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp) onlytri = 0; if (onlytri && groupfaces.Size() <= 20 + 2*stat.qualclass && - FindInnerPoint (grouppoints, groupfaces, inp)) + FindInnerPoint (grouppoints, groupfaces, inp) && + !adfront->PointInsideGroup(grouppindex, groupfaces)) { (*testout) << "inner point found" << endl; diff --git a/rules/tetrules.rls b/rules/tetrules.rls index faad6c43..53eb6058 100644 --- a/rules/tetrules.rls +++ b/rules/tetrules.rls @@ -139,7 +139,7 @@ endrule rule "Tetrahedron Vis a Vis Point (1)" -quality 100 +quality 20 mappoints (0, 0, 0);