0031616: Modeling algorithm - Section between two shells returns wire with gaps ...
authorifv <ifv@opencascade.com>
Wed, 17 Jun 2020 14:10:12 +0000 (17:10 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 1 Jul 2020 14:50:56 +0000 (17:50 +0300)
Adaptor3d_TopolTool.cxx, IntTools_TopolTool.cxx:

Anisotropy of BSpline surface along U and V direction is taken in account for calculation of numbers of sample points;

bug31616: test case added

src/Adaptor3d/Adaptor3d_TopolTool.cxx
src/IntTools/IntTools_TopolTool.cxx
tests/bugs/modalg_7/bug31616 [new file with mode: 0644]

index 6ce96fd..09a7eaa 100644 (file)
@@ -654,7 +654,10 @@ static void Analyse(const TColgp_Array2OfPnt& array2,
 }  
 
 
-void Adaptor3d_TopolTool::ComputeSamplePoints() { 
+void Adaptor3d_TopolTool::ComputeSamplePoints() 
+{ 
+  const Standard_Integer aMaxNbSample = 50;
+
   Standard_Real uinf,usup,vinf,vsup;
   uinf = myS->FirstUParameter();  usup = myS->LastUParameter();
   vinf = myS->FirstVParameter();  vsup = myS->LastVParameter();
@@ -692,31 +695,49 @@ void Adaptor3d_TopolTool::ComputeSamplePoints() {
   //-- 
   
   if(nbsu<6) nbsu=6;
-  if(nbsv<6) nbsv=6;
-  
-  myNbSamplesU = nbsu;
-  myNbSamplesV = nbsv;
+  if(nbsv<6) nbsv=6; 
 
-  if(nbsu>8 || nbsv>8) {
-    if(typS == GeomAbs_BSplineSurface) { 
+  if (typS == GeomAbs_BSplineSurface) {
+    if (nbsu > 8 || nbsv>8) {
       const Handle(Geom_BSplineSurface)& Bspl = myS->BSpline();
       Standard_Integer nbup = Bspl->NbUPoles();
       Standard_Integer nbvp = Bspl->NbVPoles();
-      TColgp_Array2OfPnt array2(1,nbup,1,nbvp);
+      TColgp_Array2OfPnt array2(1, nbup, 1, nbvp);
       Bspl->Poles(array2);
-      Analyse(array2,nbup,nbvp,myNbSamplesU,myNbSamplesV);
+      Analyse(array2, nbup, nbvp, nbsu, nbsv);
+    }
+    // Check anisotropy
+    Standard_Real anULen = (usup - uinf) / myS->UResolution(1.);
+    Standard_Real anVLen = (vsup - vinf) / myS->VResolution(1.);
+    Standard_Real aRatio = anULen / anVLen;
+    if (aRatio >= 10.)
+    {
+      nbsu *= 2;
+      nbsu = Min(nbsu, aMaxNbSample);
     }
-    else if(typS == GeomAbs_BezierSurface) { 
+    else if (aRatio <= 0.1)
+    {
+      nbsv *= 2;
+      nbsv = Min(nbsv, aMaxNbSample);
+    }
+  }
+  else if (typS == GeomAbs_BezierSurface) {
+    if (nbsu > 8 || nbsv > 8) {
       const Handle(Geom_BezierSurface)& Bez = myS->Bezier();
       Standard_Integer nbup = Bez->NbUPoles();
       Standard_Integer nbvp = Bez->NbVPoles();
-      TColgp_Array2OfPnt array2(1,nbup,1,nbvp);
+      TColgp_Array2OfPnt array2(1, nbup, 1, nbvp);
       Bez->Poles(array2);
-      Analyse(array2,nbup,nbvp,myNbSamplesU,myNbSamplesV);
+      Analyse(array2, nbup, nbvp, nbsu, nbsv);
     }
   }
+
+  myNbSamplesU = nbsu;
+  myNbSamplesV = nbsv;
+
 }
 
+
 Standard_Integer Adaptor3d_TopolTool::NbSamplesU()
 { 
   if(myNbSamplesU <0) {
index 863e068..bd2e031 100644 (file)
@@ -246,6 +246,20 @@ void IntTools_TopolTool::ComputeSamplePoints()
     }
     if(nbsu < 10) nbsu = 10;
     if(nbsv < 10) nbsv = 10;
+    // Check anisotropy
+    Standard_Real anULen = (usup - uinf) / myS->UResolution(1.);
+    Standard_Real anVLen = (vsup - vinf) / myS->VResolution(1.);
+    Standard_Real aRatio = anULen / anVLen;
+    if (aRatio >= 10.)
+    {
+      nbsu *= 2;
+      nbsu = Min(nbsu, aMaxNbSample);
+    }
+    else if (aRatio <= 0.1 )
+    {
+      nbsv *= 2;
+      nbsv = Min(nbsv, aMaxNbSample);
+    }
   }
     break;
   case GeomAbs_SurfaceOfExtrusion: {
diff --git a/tests/bugs/modalg_7/bug31616 b/tests/bugs/modalg_7/bug31616
new file mode 100644 (file)
index 0000000..d774614
--- /dev/null
@@ -0,0 +1,15 @@
+puts "============================================================================================="
+puts "OCC31616: Modeling algorithm - Section between two shells returns wire with gaps (720)"
+puts "============================================================================================="
+puts ""
+
+restore [locate_data_file bug31616.brep] s
+
+explode s 
+
+bsection sec s_1 s_2
+
+checksection sec -r 2
+checknbshapes sec -vertex 69 -edge 68
+checkprops sec -l 20.7581
+