]> OCCT Git - occt.git/commitdiff
0025263: Wrong result of cut operation.
authorpkv <pkv@opencascade.com>
Fri, 26 Sep 2014 13:13:56 +0000 (17:13 +0400)
committerbugmaster <bugmaster@opencascade.com>
Fri, 26 Sep 2014 13:15:12 +0000 (17:15 +0400)
Changes:
class BOPDS_DS
method:
void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)

The treatment of internal edges has been added.

Test case for issue CR25263

src/BOPDS/BOPDS_DS.cxx
tests/bugs/modalg_5/bug25263 [new file with mode: 0644]

index fc8ee91556817791ae5321300bbcbc124d2042fa..b0ab814afc9c1198cb67e5eeb618d426f3d5b570 100644 (file)
@@ -813,8 +813,9 @@ BOPDS_ListOfPaveBlock& BOPDS_DS::ChangePaveBlocks
 //=======================================================================
 void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
 {
-  Standard_Integer nV = 0, iRef, aNbV, nVSD, i;
+  Standard_Integer nV=0, iRef, aNbV, nVSD;
   Standard_Real aT;
+  TopAbs_Orientation aOrE;
   TopoDS_Vertex aV;
   BOPCol_ListIteratorOfListOfInteger aIt;
   BOPDS_Pave aPave;
@@ -822,6 +823,7 @@ void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
   //
   BOPDS_ShapeInfo& aSI=ChangeShapeInfo(theI);
   const TopoDS_Edge& aE=*(TopoDS_Edge*)(&aSI.Shape());
+  aOrE=aE.Orientation();
   //
   const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
   aNbV=aLV.Extent();
@@ -832,33 +834,49 @@ void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
   aPB=new BOPDS_PaveBlock; 
   aPB->SetOriginalEdge(theI);
   //
-  aIt.Initialize(aLV);
-  for (i=0; aIt.More(); aIt.Next(), ++i) {
-    nV=aIt.Value();
-    //
-    const BOPDS_ShapeInfo& aSIV=ShapeInfo(nV);
-    aV=*(TopoDS_Vertex*)(&aSIV.Shape());
-    if (aSIV.HasFlag()) {
-      aT=ComputeParameter(aV, aE); 
+  if (aOrE!=TopAbs_INTERNAL) {
+    aIt.Initialize(aLV);
+    for (; aIt.More(); aIt.Next()) {
+      nV=aIt.Value();
+      //
+      const BOPDS_ShapeInfo& aSIV=ShapeInfo(nV);
+      aV=*(TopoDS_Vertex*)(&aSIV.Shape());
+      if (aSIV.HasFlag()) {
+        aT=ComputeParameter(aV, aE); 
+      }
+      else {
+        aT=BRep_Tool::Parameter(aV, aE);
+      } 
+      //
+      if (HasShapeSD(nV, nVSD)) {
+        nV=nVSD;
+      }
+      aPave.SetIndex(nV);
+      aPave.SetParameter(aT);
+      aPB->AppendExtPave(aPave);
     }
-    else {
-      aT=BRep_Tool::Parameter(aV, aE);
-    } 
     //
-    if (HasShapeSD(nV, nVSD)) {
-      nV=nVSD;
+    if (aNbV==1) {
+      aV.Reverse();
+      aT=BRep_Tool::Parameter(aV, aE);
+      aPave.SetIndex(nV);
+      aPave.SetParameter(aT);
+      aPB->AppendExtPave1(aPave);
     }
-    aPave.SetIndex(nV);
-    aPave.SetParameter(aT);
-    aPB->AppendExtPave(aPave);
   }
   //
-  if (aNbV==1) {
-    aV.Reverse();
-    aT=BRep_Tool::Parameter(aV, aE);
-    aPave.SetIndex(nV);
-    aPave.SetParameter(aT);
-    aPB->AppendExtPave1(aPave);
+  else {
+    TopoDS_Iterator aItE;
+    //
+    aItE.Initialize(aE, Standard_False, Standard_True);
+    for (; aItE.More(); aItE.Next()) {
+      aV=*((TopoDS_Vertex*)&aItE.Value());
+      nV=Index(aV);
+      aT=BRep_Tool::Parameter(aV, aE);
+      aPave.SetIndex(nV);
+      aPave.SetParameter(aT);
+      aPB->AppendExtPave1(aPave);
+    }
   }
   //
   iRef = myPaveBlocksPool.Append() - 1;
diff --git a/tests/bugs/modalg_5/bug25263 b/tests/bugs/modalg_5/bug25263
new file mode 100644 (file)
index 0000000..dada6b1
--- /dev/null
@@ -0,0 +1,28 @@
+puts "============"
+puts "OCC25263"
+puts "============"
+puts ""
+######################################################
+# Wrong result of cut operation.
+######################################################
+
+restore [locate_data_file bug25263_Face_cylindrique.brep] b1
+restore [locate_data_file bug25263_camembert.brep] b2
+
+bop b1 b2
+bopcut result
+
+set square 3.76991
+
+# Analysis of "nbshapes res"
+set nb_v_good 3
+set nb_e_good 4
+set nb_w_good 1
+set nb_f_good 1
+set nb_sh_good 1
+set nb_sol_good 0
+set nb_compsol_good 0
+set nb_compound_good 1
+set nb_shape_good 11
+
+set 2dviewer 1