fix closesurface identification with degenerated edges

This commit is contained in:
Christopher Lackner 2022-12-19 13:26:18 +01:00
parent ee7bcf82be
commit 36644161b3
4 changed files with 11 additions and 2 deletions

View File

@ -55,6 +55,8 @@ namespace netgen
if(!other_ptr) if(!other_ptr)
return false; return false;
auto & e = *other_ptr; auto & e = *other_ptr;
if (IsDegenerated(tol) || e.IsDegenerated(tol))
return false;
if(tol < Dist(trafo(GetCenter()), e.GetCenter())) if(tol < Dist(trafo(GetCenter()), e.GetCenter()))
return false; return false;

View File

@ -92,6 +92,9 @@ namespace netgen
virtual Point<3> GetPoint(double t) const = 0; virtual Point<3> GetPoint(double t) const = 0;
// Calculate parameter step respecting edges sag value // Calculate parameter step respecting edges sag value
virtual double CalcStep(double t, double sag) const = 0; 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 ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const = 0;
virtual void PointBetween(const Point<3>& p1, virtual void PointBetween(const Point<3>& p1,
const Point<3>& p2, const Point<3>& p2,

View File

@ -6,6 +6,7 @@
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <BRep_TEdge.hxx> #include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#include "occ_vertex.hpp" #include "occ_vertex.hpp"
#include "meshing.hpp" #include "meshing.hpp"
@ -32,6 +33,9 @@ namespace netgen
size_t GetHash() const override; size_t GetHash() const override;
void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override; void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override;
Vec<3> GetTangent(double t) const override; Vec<3> GetTangent(double t) const override;
bool IsDegenerated(double) const override {
return BRep_Tool::Degenerated(edge);
}
}; };
} }

View File

@ -152,7 +152,7 @@ namespace netgen
} }
static bool HaveProperties(const TopoDS_Shape& shape) 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<OCCIdentification>& GetIdentifications(const TopoDS_Shape& shape) static std::vector<OCCIdentification>& GetIdentifications(const TopoDS_Shape& shape)
{ {
@ -165,7 +165,7 @@ namespace netgen
} }
static bool HaveIdentifications(const TopoDS_Shape& shape) 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; TopoDS_Shape shape;