]> OCCT Git - occt-copy.git/commitdiff
BOPAlgo_PaveFiller::PerformEE - Consider the IsOnPave check satisfying for vertex... CR30010
authoremv <emv@opencascade.com>
Fri, 3 Aug 2018 08:11:06 +0000 (11:11 +0300)
committeremv <emv@opencascade.com>
Fri, 3 Aug 2018 11:44:49 +0000 (14:44 +0300)
BOPTools_AlgoTools3D::PointInFace - Making the method more robust by checking more hatching lines.

src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
src/BOPTools/BOPTools_AlgoTools3D.cxx

index c9b4d013f00a62c29e3063ed8b3ccf30400afabc..4ffc8fdcd86908860e70670a4135f45221177eb6 100644 (file)
@@ -399,46 +399,7 @@ void BOPAlgo_PaveFiller::PerformEE()
               aTolVnew = aTolMin;
             }
           }
-          // <-LXBR
-          {
-            Standard_Integer nVS[2], iFound;
-            Standard_Real aTolVx, aD2, aDT2;
-            TColStd_MapOfInteger aMV;
-            gp_Pnt aPx;
-            //
-            iFound=0;
-            j=-1;
-            aMV.Add(nV[0]);
-            aMV.Add(nV[1]);
-            //
-            if (aMV.Contains(nV[2])) {
-              ++j;
-              nVS[j]=nV[2];
-            }
-            if (aMV.Contains(nV[3])) {
-              ++j;
-              nVS[j]=nV[3];
-            }
-            //
-            for (Standard_Integer k1=0; k1<=j; ++k1) {
-              const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k1]));
-              aTolVx=BRep_Tool::Tolerance(aVx);
-              aPx=BRep_Tool::Pnt(aVx);
-              aD2=aPnew.SquareDistance(aPx);
-              //
-              aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
-              //
-              if (aD2<aDT2) {
-                iFound=1;
-                break;
-              }
-            }
-            //
-            if (iFound) {
-              continue;
-            }
-          }
-          //
+
           // 1
           BOPDS_InterfEE& aEE=aEEs.Appended();
           iX=aEEs.Length()-1;
index 06653d1605f84f005ac66d7b9bc6c3da44fc5c03..92baf3fa97ac02f83f049365cb045110d3ad43cf 100644 (file)
@@ -785,30 +785,55 @@ Standard_Integer BOPTools_AlgoTools3D::PointInFace
    gp_Pnt2d& theP2D,
    const Handle(IntTools_Context)& theContext)
 {
-  Standard_Integer i, iErr = 1;
-  Standard_Real aUMin, aUMax, aVMin, aVMax, aUx;
-  //
+  // Error status
+  Standard_Integer iErr = 1;
+
+  // Get UV bounds of the face
+  Standard_Real aUMin, aUMax, aVMin, aVMax;
   theContext->UVBounds(theF, aUMin, aUMax, aVMin, aVMax);
-  //
-  gp_Dir2d aD2D(0. , 1.);
-  aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax);
-  //
-  for (i = 0; i < 2; ++i) {
-    gp_Pnt2d aP2D(aUx, 0.);
+
+  // Middle point of the 2d bounding box of the face
+  Standard_Real aUx = IntTools_Tools::IntermediatePoint(aUMin, aUMax),
+                aVx = IntTools_Tools::IntermediatePoint(aVMin, aVMax);
+
+  for (Standard_Integer i = 0; i < 4; ++i)
+  {
+    // Point to start the hatching line
+    gp_Pnt2d aP2D(aUx, aVx);
+    // Direction for the hatching line
+    gp_Dir2d aD2D  = (i < 2) ? gp::DY2d() : gp::DX2d();
     Handle(Geom2d_Line) aL2D = new Geom2d_Line (aP2D, aD2D);
     iErr = BOPTools_AlgoTools3D::PointInFace
       (theF, aL2D, theP, theP2D, theContext);
-    if (iErr == 0) {
+    if (iErr == 0)
       // done
-      break;
-    }
-    else {
-      // possible reason - incorrect computation of the 2d box of the face.
-      // try to compute the point with the translated line.
-      aUx = aUMax - (aUx - aUMin);
+      return iErr;
+    else
+    {
+      // Possible reason - incorrect computation of the 2d box of the face.
+      // Try to compute the point with the translated line.
+      if (i < 2)
+        aUx = aUMax - (aUx - aUMin);
+      else
+        aVx = aVMax - (aVx - aVMin);
     }
   }
-  //
+
+  // The tries to find the point using the hatching line passing through
+  // the middle of the bounding box of the face have failed.
+  // Try to start hatching line at the middle of the edges of the face.
+  TopExp_Explorer anExpE(theF, TopAbs_EDGE);
+  for (; anExpE.More(); anExpE.Next())
+  {
+    const TopoDS_Edge& aE = TopoDS::Edge(anExpE.Current());
+    Standard_Real aT1, aT2;
+    BRep_Tool::Range(aE, aT1, aT2);
+    iErr = BOPTools_AlgoTools3D::PointInFace
+      (theF, aE, 0.5 * (aT1 + aT2), 0.0, theP, theP2D, theContext);
+    if (iErr == 0)
+      return iErr;
+  }
+
   return iErr;
 }
 //=======================================================================