0023472: BRepAlgoAPI_Section algorithm fails with exception while intersecting two...
authorjgv <jgv@opencascade.com>
Fri, 19 Oct 2012 14:53:19 +0000 (18:53 +0400)
committerjgv <jgv@opencascade.com>
Fri, 19 Oct 2012 14:53:19 +0000 (18:53 +0400)
src/Adaptor3d/Adaptor3d_TopolTool.cxx
tests/bugs/modalg/bug23472 [new file with mode: 0755]

index b7861f4..0fea9e6 100755 (executable)
@@ -1070,7 +1070,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
 
   anUFlg(1) = Standard_True;
   anUFlg(nbsu) = Standard_True;
 
   anUFlg(1) = Standard_True;
   anUFlg(nbsu) = Standard_True;
-  myNbSamplesU = 2; 
+  //myNbSamplesU = 2; 
   for(i = 1; i <= nbsv; ++i) {
     t1 = aVPars(i);
     j = 1;
   for(i = 1; i <= nbsv; ++i) {
     t1 = aVPars(i);
     j = 1;
@@ -1113,7 +1113,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
        if(!ok) {
          j = k - 1;
          anUFlg(j) = Standard_True;
        if(!ok) {
          j = k - 1;
          anUFlg(j) = Standard_True;
-         ++myNbSamplesU;
+         //++myNbSamplesU;
          break;
        }
        
          break;
        }
        
@@ -1129,6 +1129,12 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
 
     }
   }
 
     }
   }
+
+  myNbSamplesU = 0;
+  for (i = 1; i <= nbsu; i++)
+    if (anUFlg(i) == Standard_True)
+      myNbSamplesU++;
+  
   if(myNbSamplesU < myMinPnts) {
     if(myNbSamplesU == 2) {
       //"uniform" distribution;
   if(myNbSamplesU < myMinPnts) {
     if(myNbSamplesU == 2) {
       //"uniform" distribution;
@@ -1149,7 +1155,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
       
   aVFlg(1) = Standard_True;
   aVFlg(nbsv) = Standard_True;
       
   aVFlg(1) = Standard_True;
   aVFlg(nbsv) = Standard_True;
-  myNbSamplesV = 2;
+  //myNbSamplesV = 2;
   for(i = 1; i <= nbsu; ++i) {
     t1 = anUPars(i);
     j = 1;
   for(i = 1; i <= nbsu; ++i) {
     t1 = anUPars(i);
     j = 1;
@@ -1191,7 +1197,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
        if(!ok) {
          j = k - 1;
          aVFlg(j) = Standard_True;
        if(!ok) {
          j = k - 1;
          aVFlg(j) = Standard_True;
-         ++myNbSamplesV;
+         //++myNbSamplesV;
          break;
        }
        
          break;
        }
        
@@ -1207,6 +1213,12 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
 
     }
   }
 
     }
   }
+
+  myNbSamplesV = 0;
+  for (i = 1; i <= nbsv; i++)
+    if (aVFlg(i) == Standard_True)
+      myNbSamplesV++;
+  
   if(myNbSamplesV < myMinPnts) {
     if(myNbSamplesV == 2) {
       //"uniform" distribution;
   if(myNbSamplesV < myMinPnts) {
     if(myNbSamplesV == 2) {
       //"uniform" distribution;
diff --git a/tests/bugs/modalg/bug23472 b/tests/bugs/modalg/bug23472
new file mode 100755 (executable)
index 0000000..396c439
--- /dev/null
@@ -0,0 +1,22 @@
+puts "============"
+puts "CR23472"
+puts "============"
+puts ""
+##########################################################################################################
+# BRepAlgoAPI_Section algorithm fails with exception while intersecting two faces
+##########################################################################################################
+
+restore [locate_data_file bug23472_f1.brep] f1
+restore [locate_data_file bug23472_f2.brep] f2
+
+bsection result f1 f2 -2d
+
+regexp {Mass +: +([-0-9.+eE]+)} [lprops result] full l      
+
+if { $l != 0} {
+  puts "Error : The bsection is not valid"
+} 
+
+# Service parameters
+set mass -0.1
+set m -0.1