]> OCCT Git - occt.git/commitdiff
0031700: Modeling Algorithms - Regression in 0029580 after integration 0029839
authorifv <ifv@opencascade.com>
Thu, 6 Aug 2020 13:17:33 +0000 (16:17 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 6 Oct 2020 17:40:24 +0000 (20:40 +0300)
BOPAlgo_PaveFiller_6.cxx: protection against creation of thin faces is added
bug29580_1: reverting in original state

dimensions.tcl: correction according to current state of BO algorithm

samples/tcl/dimensions.tcl
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
tests/bugs/modalg_7/bug29580_1

index 2c651b1a9f15bec1377568cc92d9e771e87f1495..e22536460d4dcca767888475700ec7eee092e981 100644 (file)
@@ -46,7 +46,7 @@ vdimension ld_4 -length -shapes as_7 -plane xoy -color black -flyout -20
 vdimension ld_5 -length -shapes as_28 -plane xoy -color black -flyout -15
 vdimension ld_6 -length -shapes as_18 -plane xoy -color black -flyout 30
 vdimension ld_7 -length -shapes bs_20 -plane xoy -color black -flyout -20
-vdimension ld_8 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
+vdimension ld_8 -length -shapes as_42 -plane xoy -color black -flyout 55 -label right
 vdimension ld_9 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
 vdimension ld_10 -length -shapes as_40 -plane xoy -color black -flyout 15
 
@@ -55,7 +55,7 @@ vdimension rd_2 -radius -shapes bs_63 -color black
 
 vdimension ad_1 -angle -shapes as_38 as_49 -color black
 vdimension ad_2 -angle -shapes bs_24 bs_25 -color black
-vdimension ad_3 -angle -shapes as_48 as_43 -color black
+vdimension ad_3 -angle -shapes as_48 as_42 -color black
 
 puts "Changing text and arrow parameters of dimensions..."
 foreach i $aList {
index 799709a2bf12d4e4fcdddec5f71ac995fdd20e2a..3d6d02918b234a12abb3949871cab3c1ef2d8fb9 100644 (file)
@@ -628,7 +628,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
         }
         //
         Standard_Integer nEOut;
-        Standard_Real aTolNew;
+        Standard_Real aTolNew = -1.;
         bExist = IsExistingPaveBlock(aPB, aNC, aLSE, nEOut, aTolNew);
         if (bExist)
         {
@@ -1646,8 +1646,13 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
   Bnd_Box aBoxPm;
   Standard_Real aTm = IntTools_Tools::IntermediatePoint (aT1, aT2);
   gp_Pnt aPm;
-  aIC.D0(aTm, aPm);
+  gp_Vec aVTgt1;
+  const Handle(Geom_Curve)& aC3d = aIC.Curve();
+  aC3d->D1(aTm, aPm, aVTgt1);
   aBoxPm.Add (aPm);
+  Standard_Boolean isVtgt1Valid = aVTgt1.SquareMagnitude() > gp::Resolution();
+  if (isVtgt1Valid)
+    aVTgt1.Normalize();
 
   // last point
   Bnd_Box aBoxP2;
@@ -1661,6 +1666,12 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
 
   Standard_Real aTolCheck = theTolR3D + myFuzzyValue;
 
+  //Some limit values to define "thin" face when iflag1=iflag2=2 and
+  //edge has no common block with any face
+  Standard_Real aMaxTolAdd = 0.001; //Maximal tolerance of edge allowed
+  const Standard_Real aCoeffTolAdd = 10.; //Coeff to define max. tolerance with help of aTolCheck
+  aMaxTolAdd = Min(aMaxTolAdd, aCoeffTolAdd * aTolCheck);
+
   // Look for the existing pave block closest to the section curve
   Standard_Boolean bFound = Standard_False;
   theTolNew = ::RealLast();
@@ -1686,6 +1697,10 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
       continue;
 
     Standard_Real aDist = 0.;
+    Standard_Real aCoeff = 1.; //Coeff for taking in account deflections between edge and theNC
+    //when aPB is not common block
+    Standard_Real aDistm1m2 = 0.;
+    Standard_Integer aPEStatus = 1;
 
     Standard_Real aRealTol = aTolCheck;
     if (myDS->IsCommonBlock(aPB))
@@ -1696,18 +1711,69 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
         // increase the chance to coincide with section curve
         aRealTol *= 2.;
     }
-      
+    else if (iFlag1 == 2 && iFlag2 == 2)
+    {
+      //Check, if edge could be common block with section curve
+      // and increase the chance to coincide with section curve
+      //skip processing if one edge is closed, but other is not closed
+      //such configurations can give iFlag1 == 2 && iFlag2 == 2
+      Standard_Boolean bSkipProcessing = ((nV11 == nV12) && (nV21 != nV22)) || ((nV11 != nV12) && (nV21 == nV22));
+
+      if (!bSkipProcessing)
+      {
+
+        if (isVtgt1Valid)
+        {
+          BRepAdaptor_Curve aBAC2(aSp);
+          if (aIC.Type() != GeomAbs_Line ||
+            aBAC2.GetType() != GeomAbs_Line)
+          {
+            Standard_Real aTldp;
+            Standard_Real aTolAdd = 2. * Min(aMaxTolAdd, Max(aRealTol, Max(aTolV1, aTolV2)));
+            aPEStatus = myContext->ComputePE(aPm, aTolAdd, aSp, 
+                                             aTldp, aDistm1m2);
+
+            if (aPEStatus == 0 )
+            {
+              gp_Pnt aPm2;
+              gp_Vec aVTgt2;
+              aBAC2.D1(aTldp, aPm2, aVTgt2);
+              if (aVTgt2.SquareMagnitude() > gp::Resolution())
+              {
+                // The angle should be close to zero
+                Standard_Real aCos = aVTgt1.Dot(aVTgt2.Normalized());
+                if (Abs(aCos) >= 0.9063)
+                {                                
+                  aRealTol = aTolAdd;
+                  aCoeff = 2.;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+
     Bnd_Box aBoxTmp = aBoxPm;
     aBoxTmp.Enlarge(aRealTol);
 
     Standard_Real aDistToSp = 0.;
     Standard_Real aTx;
-    if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm, 
-                                                      aRealTol,
-                                                      aSp, 
-                                                      aTx, aDistToSp)) {
+    if (aBoxSp.IsOut(aBoxTmp) || aPEStatus < 0)
+    {
       continue;
     }
+    else if(aPEStatus == 0) //aPEStatus == 0 for case iflag1 == iflag2 == 2
+    {
+      aDistToSp = aDistm1m2;
+    }
+    else if (aPEStatus == 1) //Projection has not been done yet
+    {
+      aPEStatus = myContext->ComputePE(aPm, aRealTol, aSp,
+                                       aTx, aDistToSp);
+      if (aPEStatus < 0)
+        continue;
+    }
     //
     if (iFlag1 == 1) {
       iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
@@ -1726,7 +1792,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
       if (aDistToSp < theTolNew)
       {
         aPBOut = aPB;
-        theTolNew = aDistToSp;
+        theTolNew = aCoeff * aDistToSp;
         bFound = Standard_True;
       }
     }
index 010433c13499a0d2cc30fab3b1d1dc0a95ac3ea8..a2a724f75c2dca88e86d271b38a50ad92348e9df 100644 (file)
@@ -9,7 +9,6 @@ puts ""
 restore [locate_data_file bug29580_Cylinder.brep] b1
 restore [locate_data_file bug29580_Solid.brep] b2
 
-settolerance b2 e 1.e-5
 bfuse result b1 b2
 
 foreach f [explode result f] {
@@ -22,7 +21,7 @@ foreach f [explode result f] {
 }
 
 checkshape result
-checknbshapes result -wire 14 -face 13 -shell 1 -solid 1
+checknbshapes result -wire 11 -face 10 -shell 1 -solid 1
 checkprops result -s 866.155 -v 1622.85
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png