From: oan Date: Sat, 19 Oct 2019 16:22:38 +0000 (+0300) Subject: 0028500: Artifact in shaded view of the shape X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=9bafa6fee66c17ad86fa5aa0d676384f77f75e3c;p=occt-copy.git 0028500: Artifact in shaded view of the shape increase minimum number of discretization points by one explicitly on each iteration of model healer to cover cases degenerated to line --- diff --git a/src/BRepMesh/BRepMesh_CurveTessellator.cxx b/src/BRepMesh/BRepMesh_CurveTessellator.cxx index bb780d27e0..105df23e90 100644 --- a/src/BRepMesh/BRepMesh_CurveTessellator.cxx +++ b/src/BRepMesh/BRepMesh_CurveTessellator.cxx @@ -34,11 +34,13 @@ //======================================================================= BRepMesh_CurveTessellator::BRepMesh_CurveTessellator( const IMeshData::IEdgeHandle& theEdge, - const IMeshTools_Parameters& theParameters) + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb) : myDEdge(theEdge), myParameters(theParameters), myEdge(theEdge->GetEdge()), - myCurve(myEdge) + myCurve(myEdge), + myMinPointsNb (theMinPointsNb) { init(); } @@ -51,11 +53,13 @@ BRepMesh_CurveTessellator::BRepMesh_CurveTessellator ( const IMeshData::IEdgeHandle& theEdge, const TopAbs_Orientation theOrientation, const IMeshData::IFaceHandle& theFace, - const IMeshTools_Parameters& theParameters) + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb) : myDEdge(theEdge), myParameters(theParameters), myEdge(TopoDS::Edge(theEdge->GetEdge().Oriented(theOrientation))), - myCurve(myEdge, theFace->GetFace()) + myCurve(myEdge, theFace->GetFace()), + myMinPointsNb (theMinPointsNb) { init(); } @@ -96,7 +100,8 @@ void BRepMesh_CurveTessellator::init() myEdgeSqTol = BRep_Tool::Tolerance (myEdge); myEdgeSqTol *= myEdgeSqTol; - const Standard_Integer aMinPntNb = (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2; //OCC287 + const Standard_Integer aMinPntNb = Max(myMinPointsNb, + (myCurve.GetType() == GeomAbs_Circle) ? 4 : 2); //OCC287 myDiscretTool.Initialize (myCurve, myCurve.FirstParameter(), myCurve.LastParameter(), diff --git a/src/BRepMesh/BRepMesh_CurveTessellator.hxx b/src/BRepMesh/BRepMesh_CurveTessellator.hxx index 4a666be6b8..4eb59c0e60 100644 --- a/src/BRepMesh/BRepMesh_CurveTessellator.hxx +++ b/src/BRepMesh/BRepMesh_CurveTessellator.hxx @@ -35,14 +35,16 @@ public: //! Constructor. Standard_EXPORT BRepMesh_CurveTessellator( const IMeshData::IEdgeHandle& theEdge, - const IMeshTools_Parameters& theParameters); + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb = 2); //! Constructor. Standard_EXPORT BRepMesh_CurveTessellator ( const IMeshData::IEdgeHandle& theEdge, const TopAbs_Orientation theOrientation, const IMeshData::IFaceHandle& theFace, - const IMeshTools_Parameters& theParameters); + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb = 2); //! Destructor. Standard_EXPORT virtual ~BRepMesh_CurveTessellator (); @@ -97,6 +99,7 @@ private: const IMeshTools_Parameters& myParameters; TopoDS_Edge myEdge; BRepAdaptor_Curve myCurve; + Standard_Integer myMinPointsNb; GCPnts_TangentialDeflection myDiscretTool; TopoDS_Vertex myFirstVertex; TopoDS_Vertex myLastVertex; diff --git a/src/BRepMesh/BRepMesh_EdgeDiscret.cxx b/src/BRepMesh/BRepMesh_EdgeDiscret.cxx index d9e575af43..04dbca5198 100644 --- a/src/BRepMesh/BRepMesh_EdgeDiscret.cxx +++ b/src/BRepMesh/BRepMesh_EdgeDiscret.cxx @@ -48,9 +48,10 @@ BRepMesh_EdgeDiscret::~BRepMesh_EdgeDiscret () //======================================================================= Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator( const IMeshData::IEdgeHandle& theDEdge, - const IMeshTools_Parameters& theParameters) + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb) { - return new BRepMesh_CurveTessellator(theDEdge, theParameters); + return new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb); } //======================================================================= @@ -61,11 +62,12 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellator( const IMeshData::IEdgeHandle& theDEdge, const TopAbs_Orientation theOrientation, const IMeshData::IFaceHandle& theDFace, - const IMeshTools_Parameters& theParameters) + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb) { return theDEdge->GetSameParam() ? - new BRepMesh_CurveTessellator(theDEdge, theParameters) : - new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters); + new BRepMesh_CurveTessellator(theDEdge, theParameters, theMinPointsNb) : + new BRepMesh_CurveTessellator(theDEdge, theOrientation, theDFace, theParameters, theMinPointsNb); } //======================================================================= diff --git a/src/BRepMesh/BRepMesh_EdgeDiscret.hxx b/src/BRepMesh/BRepMesh_EdgeDiscret.hxx index 82ac8e48d2..76733d5f50 100644 --- a/src/BRepMesh/BRepMesh_EdgeDiscret.hxx +++ b/src/BRepMesh/BRepMesh_EdgeDiscret.hxx @@ -38,14 +38,16 @@ public: //! Creates instance of free edge tessellator. Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator( const IMeshData::IEdgeHandle& theDEdge, - const IMeshTools_Parameters& theParameters); + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb = 2); //! Creates instance of edge tessellator. Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator( const IMeshData::IEdgeHandle& theDEdge, const TopAbs_Orientation theOrientation, const IMeshData::IFaceHandle& theDFace, - const IMeshTools_Parameters& theParameters); + const IMeshTools_Parameters& theParameters, + const Standard_Integer theMinPointsNb = 2); //! Creates instance of tessellation extractor. Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor( diff --git a/src/BRepMesh/BRepMesh_ModelHealer.cxx b/src/BRepMesh/BRepMesh_ModelHealer.cxx index 6ad9b83f56..933aff2d77 100644 --- a/src/BRepMesh/BRepMesh_ModelHealer.cxx +++ b/src/BRepMesh/BRepMesh_ModelHealer.cxx @@ -49,6 +49,9 @@ namespace void operator()(const IMeshData::IEdgePtr& theDEdge) const { const IMeshData::IEdgeHandle aDEdge = theDEdge; + + const Standard_Integer aPointsNb = aDEdge->GetCurve()->ParametersNb(); + aDEdge->Clear(Standard_True); aDEdge->SetDeflection(Max(aDEdge->GetDeflection() / 3., Precision::Confusion())); @@ -56,7 +59,8 @@ namespace const IMeshData::IFaceHandle aDFace = aPCurve->GetFace(); Handle(IMeshTools_CurveTessellator) aTessellator = BRepMesh_EdgeDiscret::CreateEdgeTessellator( - aDEdge, aPCurve->GetOrientation(), aDFace, myParameters); + aDEdge, aPCurve->GetOrientation(), aDFace, + myParameters, aPointsNb + 1); BRepMesh_EdgeDiscret::Tessellate3d(aDEdge, aTessellator, Standard_False); BRepMesh_EdgeDiscret::Tessellate2d(aDEdge, Standard_False);