]> OCCT Git - occt-copy.git/commitdiff
0031199: BRepMesh fails on thin faces
authoroan <oan@opencascade.com>
Wed, 4 Dec 2019 09:26:10 +0000 (12:26 +0300)
committerazv <azv@opencascade.com>
Thu, 5 Dec 2019 04:58:34 +0000 (07:58 +0300)
Use real tolerance of a face to define threshold for tolerance of discrete model instead of empirical values based on discrete model itself

src/BRepMesh/BRepMesh_DefaultRangeSplitter.cxx

index a3307f36e5810eea773900fedbe9083053789d43..ae5041418e2b6d4a586026bc5e8f47eb2bd58eae 100644 (file)
@@ -18,6 +18,7 @@
 #include <GCPnts_AbscissaPoint.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAbs_IsoType.hxx>
+#include <BRep_Tool.hxx>
 
 //=======================================================================
 // Function: Reset
@@ -125,9 +126,14 @@ void BRepMesh_DefaultRangeSplitter::computeTolerance(
   const Standard_Real aDiffU = myRangeU.second - myRangeU.first;
   const Standard_Real aDiffV = myRangeV.second - myRangeV.first;
 
+  const Standard_Real      aTolerance = BRep_Tool::Tolerance (myDFace->GetFace());
+  const Adaptor3d_Surface& aSurface   = GetSurface()->Surface();
+  const Standard_Real      aResU      = aSurface.UResolution (aTolerance);
+  const Standard_Real      aResV      = aSurface.VResolution (aTolerance);
+
   const Standard_Real aDeflectionUV = 1.e-05;
-  myTolerance.first  = Max(aDeflectionUV, Precision::Confusion() * aDiffU);
-  myTolerance.second = Max(aDeflectionUV, Precision::Confusion() * aDiffV);
+  myTolerance.first  = Max(Min(aDeflectionUV, aResU), 1e-7 * aDiffU);
+  myTolerance.second = Max(Min(aDeflectionUV, aResV), 1e-7 * aDiffV);
 }
 
 //=======================================================================