diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index 7926f938..a4b0b7a4 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -55,6 +55,8 @@ namespace netgen if(!other_ptr) return false; auto & e = *other_ptr; + if (IsDegenerated(tol) || e.IsDegenerated(tol)) + return false; if(tol < Dist(trafo(GetCenter()), e.GetCenter())) return false; diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index e1d56e43..6b38f11f 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -92,6 +92,9 @@ namespace netgen virtual Point<3> GetPoint(double t) const = 0; // Calculate parameter step respecting edges sag value virtual double CalcStep(double t, double sag) const = 0; + virtual bool IsDegenerated(double tol = 1e-10) const { + return GetLength() < tol; + } virtual void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const = 0; virtual void PointBetween(const Point<3>& p1, const Point<3>& p2, diff --git a/libsrc/occ/occ_edge.hpp b/libsrc/occ/occ_edge.hpp index a635c221..1770e56a 100644 --- a/libsrc/occ/occ_edge.hpp +++ b/libsrc/occ/occ_edge.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "occ_vertex.hpp" #include "meshing.hpp" @@ -32,6 +33,9 @@ namespace netgen size_t GetHash() const override; void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override; Vec<3> GetTangent(double t) const override; + bool IsDegenerated(double) const override { + return BRep_Tool::Degenerated(edge); + } }; } diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index d242fb30..a43e6c78 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -152,7 +152,7 @@ namespace netgen } static bool HaveProperties(const TopoDS_Shape& shape) { - return OCCGeometry::global_shape_property_indices.FindIndex(shape) > 1; + return OCCGeometry::global_shape_property_indices.FindIndex(shape) > 0; } static std::vector& GetIdentifications(const TopoDS_Shape& shape) { @@ -165,7 +165,7 @@ namespace netgen } static bool HaveIdentifications(const TopoDS_Shape& shape) { - return OCCGeometry::global_identification_indices.FindIndex(shape) > 1; + return OCCGeometry::global_identification_indices.FindIndex(shape) > 0; } TopoDS_Shape shape;