diff --git a/libsrc/csg/csgeom.cpp b/libsrc/csg/csgeom.cpp index f8145009..ad3912d4 100644 --- a/libsrc/csg/csgeom.cpp +++ b/libsrc/csg/csgeom.cpp @@ -72,11 +72,12 @@ namespace netgen Clean(); } - void CSGeometry :: ProjectPoint(int surfind, Point<3> & p) const + PointGeomInfo CSGeometry :: ProjectPoint(int surfind, Point<3> & p) const { Point<3> hp = p; GetSurface(surfind)->Project (hp); p = hp; + return PointGeomInfo(); } bool CSGeometry :: ProjectPointGI(int surfind, Point<3> & p, PointGeomInfo & gi) const diff --git a/libsrc/csg/csgeom.hpp b/libsrc/csg/csgeom.hpp index 07844c91..32473ed0 100644 --- a/libsrc/csg/csgeom.hpp +++ b/libsrc/csg/csgeom.hpp @@ -188,7 +188,7 @@ namespace netgen virtual void SaveToMeshFile (ostream & ost) const override; - void ProjectPoint(INDEX surfind, Point<3> & p) const override; + PointGeomInfo ProjectPoint(INDEX surfind, Point<3> & p) const override; bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override; void ProjectPointEdge(INDEX surfind, INDEX surfind2, Point<3> & p) const override; Vec<3> GetNormal(int surfind, const Point<3> & p) const override; diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index d9542149..ec3930fa 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -95,6 +95,9 @@ namespace netgen mesh.SetLocalH(bounding_box.PMin(), bounding_box.PMax(), mparam.grading); + // only set meshsize for edges longer than this + double mincurvelength = 1e-3 * bounding_box.Diam(); + if(mparam.uselocalh) { double eps = 1e-12 * bounding_box.Diam(); @@ -108,7 +111,7 @@ namespace netgen const auto & edge = edges[i]; auto length = edge->GetLength(); // skip very short edges - if(length < eps) + if(length < mincurvelength) continue; static constexpr int npts = 20; // restrict mesh size based on edge length diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index b9e7bb16..53808739 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -50,7 +50,7 @@ namespace netgen virtual size_t GetNBoundaries() const = 0; virtual Array> GetBoundary(size_t index) const = 0; virtual string GetName() const { return "default"; } - virtual void Project(Point<3>& p) const = 0; + virtual PointGeomInfo Project(Point<3>& p) const = 0; // Project point using geo info. Fast if point is close to // parametrization in geo info. virtual bool ProjectPointGI(Point<3>& p, PointGeomInfo& gi) const =0; @@ -124,9 +124,9 @@ namespace netgen virtual void FinalizeMesh(Mesh& mesh) const {} - virtual void ProjectPoint (int surfind, Point<3> & p) const + virtual PointGeomInfo ProjectPoint (int surfind, Point<3> & p) const { - faces[surfind-1]->Project(p); + return faces[surfind-1]->Project(p); } virtual void ProjectPointEdge (int surfind, int surfind2, Point<3> & p) const diff --git a/libsrc/meshing/meshing2.cpp b/libsrc/meshing/meshing2.cpp index 070a31ef..e275bb22 100644 --- a/libsrc/meshing/meshing2.cpp +++ b/libsrc/meshing/meshing2.cpp @@ -176,7 +176,7 @@ namespace netgen { locpoint = p1 + (h*plainpoint(0)) * ex + (h* plainpoint(1)) * ey; if (!geo.ProjectPointGI(gi.trignum, locpoint, gi)) - geo.ProjectPoint(gi.trignum, locpoint); + gi = geo.ProjectPoint(gi.trignum, locpoint); return 0; } diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 96434678..6b54ed66 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1034,7 +1034,7 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a SetCenter(); } - void OCCGeometry :: ProjectPoint(int surfi, Point<3> & p) const + PointGeomInfo OCCGeometry :: ProjectPoint(int surfi, Point<3> & p) const { static int cnt = 0; if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl; @@ -1048,9 +1048,12 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a suval.Coord( u, v); pnt = thesurf->Value( u, v ); - + PointGeomInfo gi; + gi.trignum = surfi; + gi.u = u; + gi.v = v; p = Point<3> (pnt.X(), pnt.Y(), pnt.Z()); - + return gi; } bool OCCGeometry :: ProjectPointGI(int surfind, Point<3>& p, PointGeomInfo& gi) const diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index 09561b29..6dd2aab7 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -280,7 +280,7 @@ namespace netgen void DoArchive(Archive& ar) override; - void ProjectPoint(int surfind, Point<3> & p) const override; + PointGeomInfo ProjectPoint(int surfind, Point<3> & p) const override; void ProjectPointEdge (int surfind, int surfind2, Point<3> & p) const override; bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override; Vec<3> GetNormal(int surfind, const Point<3> & p) const override; diff --git a/libsrc/stlgeom/stlgeom.cpp b/libsrc/stlgeom/stlgeom.cpp index 7d254162..8adcaaaa 100644 --- a/libsrc/stlgeom/stlgeom.cpp +++ b/libsrc/stlgeom/stlgeom.cpp @@ -144,7 +144,7 @@ bool STLGeometry :: ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & g return true; } -void STLGeometry :: ProjectPoint (INDEX surfind, Point<3> & p) const +PointGeomInfo STLGeometry :: ProjectPoint (INDEX surfind, Point<3> & p) const { throw Exception("ProjectPoint without PointGeomInfo not implemented"); } diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp index e29e4824..f542d11b 100644 --- a/libsrc/stlgeom/stlgeom.hpp +++ b/libsrc/stlgeom/stlgeom.hpp @@ -193,7 +193,7 @@ namespace netgen virtual void Save (string filename) const override; bool CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point<3> & p3) const override; - void ProjectPoint(INDEX surfind, Point<3> & p) const override; + PointGeomInfo ProjectPoint(INDEX surfind, Point<3> & p) const override; bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const override; Vec<3> GetNormal(int surfind, const Point<3> & p) const override; Vec<3> GetNormal(int surfind, const Point<3> & p, const PointGeomInfo & gi) const override;