From 59427cbc91be09967957929ee022addfbac92b42 Mon Sep 17 00:00:00 2001 From: pkv Date: Fri, 26 Sep 2014 17:13:56 +0400 Subject: [PATCH] 0025263: Wrong result of cut operation. 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 | 64 +++++++++++++++++++++++------------- tests/bugs/modalg_5/bug25263 | 28 ++++++++++++++++ 2 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 tests/bugs/modalg_5/bug25263 diff --git a/src/BOPDS/BOPDS_DS.cxx b/src/BOPDS/BOPDS_DS.cxx index fc8ee91556..b0ab814afc 100644 --- a/src/BOPDS/BOPDS_DS.cxx +++ b/src/BOPDS/BOPDS_DS.cxx @@ -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 index 0000000000..dada6b1869 --- /dev/null +++ b/tests/bugs/modalg_5/bug25263 @@ -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 -- 2.39.5