]> OCCT Git - occt.git/commitdiff
0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation
authorazv <azv@opencascade.com>
Fri, 19 Feb 2021 19:34:56 +0000 (22:34 +0300)
committerkgv <kgv@opencascade.com>
Sun, 20 Mar 2022 19:18:11 +0000 (22:18 +0300)
Do not limit the normalization factor of the highly anisotropic parametric space when filtering start points in the algorithm of walking line construction.
Additionally check the knots are in the increasing orders when merging two B-spline curves

src/GeomConvert/GeomConvert_CompCurveToBSplineCurve.cxx
src/IntWalk/IntWalk_IWalking_2.gxx
tests/bugs/modalg_7/bug32066 [new file with mode: 0644]
tests/hlr/exact_hlr/bug27979_6

index addfba1ec8cdcd261803ec6af135c2b105242ac8..93dc6284266b635e1b8d27c88a00e5359e026a1a 100644 (file)
@@ -132,7 +132,7 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
   if (SecondCurve->Degree() < Deg)  { SecondCurve->IncreaseDegree(Deg); }
 
 // Declarationd
-  Standard_Real L1, L2, U_de_raccord;
+  Standard_Real L1, L2;
   Standard_Integer ii, jj;
   Standard_Real  Ratio=1, Ratio1, Ratio2, Delta1, Delta2;
   Standard_Integer NbP1 = FirstCurve->NbPoles(), NbP2 = SecondCurve->NbPoles();
@@ -159,7 +159,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
     Delta1 = 0;
     Ratio2 = 1/Ratio;
     Delta2 = Ratio2*SecondCurve->Knot(1) - FirstCurve->Knot(NbK1);
-    U_de_raccord = FirstCurve->LastParameter();
   }
   else {
 // On ne bouge pas la seconde courbe
@@ -167,12 +166,11 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
     Delta1 = Ratio1*FirstCurve->Knot(NbK1) - SecondCurve->Knot(1);
     Ratio2 = 1;
     Delta2 = 0;
-    U_de_raccord = SecondCurve->FirstParameter();
   }    
 
 // Les Noeuds
   Standard_Real eps;
-  for (ii=1; ii<NbK1; ii++) {
+  for (ii=1; ii<=NbK1; ii++) {
     Noeuds(ii) = Ratio1*FirstCurve->Knot(ii) - Delta1;
     if(ii > 1) {
       eps = Epsilon (Abs(Noeuds(ii-1)));
@@ -183,11 +181,6 @@ void GeomConvert_CompCurveToBSplineCurve::Add(
     }
     Mults(ii) = FirstCurve->Multiplicity(ii);
   }
-  Noeuds(NbK1) = U_de_raccord;
-  eps = Epsilon (Abs(Noeuds(NbK1-1)));
-  if(Noeuds(NbK1) - Noeuds(NbK1-1) <= eps) {
-    Noeuds(NbK1) += eps;
-  }
   Mults(NbK1) = FirstCurve->Degree();
   for (ii=2, jj=NbK1+1; ii<=NbK2; ii++, jj++) {
     Noeuds(jj) = Ratio2*SecondCurve->Knot(ii) - Delta2;
index 2e5d7f0cdd2d319dec598d6144e47e70daf7d05e..4e9933ad8c05b93c954aaf252d0fed844fa89090 100644 (file)
@@ -400,8 +400,15 @@ Standard_Boolean IntWalk_IWalking::TestArretPassage
 
   //Normalizing factor. If it is less than 1.0 then the range will be expanded. 
   //This is no good for computation. Therefore, it is limited.
-  const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um : Max(mySRangeU.Delta(), 1.0);
-  const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm : Max(mySRangeV.Delta(), 1.0);
+  //Do not limit this factor in case of highly anisotropic parametrization
+  //(parametric space is considerably larger in one direction than another).
+  const Standard_Boolean isHighlyAnisotropic = Max(tolu, tolv) > 1000. * Min(tolu, tolv);
+  const Standard_Real deltau = mySRangeU.IsVoid() ? UM - Um
+                                                  : (isHighlyAnisotropic ? mySRangeU.Delta()
+                                                                         : Max(mySRangeU.Delta(), 1.0));
+  const Standard_Real deltav = mySRangeV.IsVoid() ? VM - Vm
+                                                  : (isHighlyAnisotropic ? mySRangeV.Delta()
+                                                                         : Max(mySRangeV.Delta(), 1.0));
 
   Up/=deltau; UV1/=deltau; 
   Vp/=deltav; UV2/=deltav;
diff --git a/tests/bugs/modalg_7/bug32066 b/tests/bugs/modalg_7/bug32066
new file mode 100644 (file)
index 0000000..5f0b0c0
--- /dev/null
@@ -0,0 +1,26 @@
+puts "======================================================="
+puts "0032066: Modeling Algorithms - Incorrect result of Boolean CUT operation"
+puts "======================================================="
+puts ""
+
+restore [locate_data_file bug32066_solid.brep] s
+
+restore [locate_data_file bug32066_hole_2547.brep] h1
+restore [locate_data_file bug32066_hole_2562.brep] h2
+restore [locate_data_file bug32066_hole_2563.brep] h3
+restore [locate_data_file bug32066_hole_2564.brep] h4
+
+bclearobjects
+bcleartools
+baddobjects s
+baddtools h1 h2 h3 h4
+bfillds
+
+bbop r 2
+
+checkshape r
+
+checknbshapes r -wire 73 -face 65 -shell 1 -solid 1 -t
+checkprops r -s 3.45489e+07 -v 1.54742e+08
+
+checkview -display r -2d -path ${imagedir}/${test_image}.png
index c758e0c07338b59dabe5de26e1040668b70d4ecf..19e579ab70450c756ceb7d4c101d454588c49766 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 227257, expected 11."
+puts "TODO OCC30286 ALL: Error : The length of result shape is"
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"