From 4e5768ce0dd589cfb039447b5df6441031503932 Mon Sep 17 00:00:00 2001 From: emv Date: Tue, 30 Oct 2012 10:06:14 +0400 Subject: [PATCH] 0021762: Integration of new Boolean Operation algorithm to OCCT. Modifications: 1. Corrections in post treatment of section edges; 2. Corrections in the accordance with the bug 0023293; 3. Small corrections in the bopcheck and bopargcheck commands. --- src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx | 1 - src/BOPAlgo/BOPAlgo_PaveFiller.cdl | 3 +- src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx | 8 ---- src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx | 60 +++++++++++++++++------- src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx | 4 +- src/BOPTest/BOPTest_CheckCommands.cxx | 1 - src/BOPTools/BOPTools_AlgoTools.cxx | 2 +- src/BOPTools/BOPTools_AlgoTools2D.cdl | 15 ++---- src/BOPTools/BOPTools_AlgoTools2D.cxx | 36 +++++--------- src/BOPTools/BOPTools_AlgoTools3D.cxx | 2 +- 10 files changed, 64 insertions(+), 68 deletions(-) diff --git a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx index a9e98a7341..bb20c71467 100644 --- a/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx +++ b/src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx @@ -318,7 +318,6 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences() BOPAlgo_CheckerSI aChecker; BOPCol_ListOfShape anArgs; anArgs.Append(aS); - anArgs.Append(aS); aChecker.SetArguments(anArgs); // aChecker.Perform(); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl index 5039f753e3..39c5441bbb 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl @@ -182,7 +182,8 @@ is theTolR3D:Real from Standard; theNC:out Curve from BOPDS; nF1:Integer from Standard; - nF2:Integer from Standard) + nF2:Integer from Standard; + aMVB:out MapOfInteger from BOPCol) is protected; ExtendedTolerance(me:out; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx index 7cce7405ea..ca4791a40e 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx @@ -124,14 +124,6 @@ // aTolE=BRep_Tool::Tolerance(aE); aTolF=BRep_Tool::Tolerance(aF); - //modified by NIZHNY-EMV Fri Oct 21 14:38:48 2011 - if (aTolE < 1.e-5) { - BRepAdaptor_Curve aBAC(aE); - if (aBAC.GetType() == GeomAbs_BSplineCurve) { - aTolE = 1.e-5; - } - } - //modified by NIZHNY-EMV Fri Oct 21 14:38:50 2011 // BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE); aIt.Initialize(aLPB); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 017e7af138..7b9567ddc4 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -339,7 +339,7 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, aNC.InitPaveBlock1(); // //modified by NIZHNY-EMV Tue Sep 27 09:10:52 2011 - PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2); + PutPaveOnCurve(aMVOnIn, aTolR3D, aNC, nF1, nF2, aMVB); //modified by NIZHNY-EMV Fri Feb 18 16:42:19 2011 ProcessUnUsedVertices(nF1, nF2, aNC, aMVStick); //pkv/904/F7 @@ -375,15 +375,6 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, // aLPB.Clear(); aPB1->Update(aLPB, Standard_False); - //modified by NIZHNY-EMV Tue Oct 25 11:11:23 2011 - Standard_Real aCurveTol; - aCurveTol = aTolR3D; - if (aCurveTol < 1.e-5) { - if (aIC.Type() == GeomAbs_BSplineCurve) { - aCurveTol = 1.e-5; - } - } - //modified by NIZHNY-EMV Tue Oct 25 11:11:25 2011 // aItLPB.Initialize(aLPB); for (; aItLPB.More(); aItLPB.Next()) { @@ -395,14 +386,15 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, continue; } //modified by NIZHNY-EMV Mon Apr 09 11:36:31 2012 - bExist=IsExistingPaveBlock(aPB, aNC, aCurveTol, aMPBOnIn); + bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn); if (bExist) { + aSC++; continue; } // - //bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE); - bExist=IsExistingPaveBlock(aPB, aNC, aCurveTol, aLSE); + bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE); if (bExist) { + aSC++; continue; } // @@ -959,12 +951,14 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, { Standard_Boolean bVF; Standard_Integer nV, iFlag, nVn, j, aNbEP; - Standard_Real aT[2], aTmin, aTmax, aTV, aTol; + Standard_Real aT[2], aTmin, aTmax, aTV, aTol, aTolVnew; gp_Pnt aP[2]; TopoDS_Vertex aVn; BOPDS_ListIteratorOfListOfPave aItLP; BOPDS_Pave aPn, aPMM[2]; // + aTolVnew = Precision::Confusion(); + // const IntTools_Curve& aIC=aNC.Curve(); aIC.Bounds(aT[0], aT[1], aP[0], aP[1]); // @@ -993,7 +987,7 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, // for (j=0; j<2; ++j) { //if curve is closed, process only one bound - if (j && aP[1].IsEqual(aP[0], Precision::Confusion())) { + if (j && aP[1].IsEqual(aP[0], aTolVnew)) { continue; } // @@ -1040,6 +1034,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, aVn=(*(TopoDS_Vertex *)(&myDS->Shape(nVn))); BOPTools_AlgoTools::UpdateVertex (aIC, aT[j], aVn); // + aTolVnew = BRep_Tool::Tolerance(aVn); + // BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn); Bnd_Box& aBoxDS=aSIDS.ChangeBox(); BRepBndLib::Add(aVn, aBoxDS); @@ -1059,7 +1055,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, const Standard_Real aTolR3D, BOPDS_Curve& aNC, const Standard_Integer nF1, - const Standard_Integer nF2) + const Standard_Integer nF2, + BOPCol_MapOfInteger& aMVB) { Standard_Boolean bIsVertexOnLine, bInBothFaces; Standard_Integer nV; @@ -1121,6 +1118,8 @@ static Standard_Boolean IsMicroEdge(const TopoDS_Edge& aE, BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV); Bnd_Box& aBoxDS=aSIDS.ChangeBox(); BRepBndLib::Add(aV, aBoxDS); + // + aMVB.Add(nV); } //modified by NIZHNY-EMV Fri Sep 23 13:35:49 2011 } @@ -1654,6 +1653,10 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, aItPB.Initialize(aMPBOnIn); for (; aItPB.More(); aItPB.Next()) { const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value(); + if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) { + continue; + } + // if (aMPB.Contains(aPB)) { continue; } @@ -1704,6 +1707,8 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, return; } // + BOPDS_MapOfPaveBlock aMPB; + BOPDS_MapIteratorOfMapOfPaveBlock aItMPB; Standard_Integer nE; Handle(BOPDS_PaveBlock) aPBf; aPBf = aLPBC.First(); @@ -1792,16 +1797,35 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, aCB->AddFace(nF2); // aPB->SetCommonBlock(aCB); + aMPB.Add(aPB); } aLPB1.Append(aPB); } } //update face info myDS->UpdateFaceInfoOn(nF1); - myDS->UpdateFaceInfoIn(nF1); // myDS->UpdateFaceInfoOn(nF2); - myDS->UpdateFaceInfoIn(nF2); + // + BOPDS_FaceInfo& aFI1 = myDS->ChangeFaceInfo(nF1); + BOPDS_FaceInfo& aFI2 = myDS->ChangeFaceInfo(nF2); + // + BOPDS_MapOfPaveBlock& aMPBOn1 = aFI1.ChangePaveBlocksOn(); + BOPDS_MapOfPaveBlock& aMPBIn1 = aFI1.ChangePaveBlocksIn(); + BOPDS_MapOfPaveBlock& aMPBOn2 = aFI2.ChangePaveBlocksOn(); + BOPDS_MapOfPaveBlock& aMPBIn2 = aFI2.ChangePaveBlocksIn(); + // + aItMPB.Initialize(aMPB); + for(; aItMPB.More(); aItMPB.Next()) { + const Handle(BOPDS_PaveBlock)& aPBnew = aItMPB.Value(); + if (!aMPBOn1.Contains(aPBnew)) { + aMPBIn1.Add(aPBnew); + } + // + if (!aMPBOn2.Contains(aPBnew)) { + aMPBIn2.Add(aPBnew); + } + } } //modified by NIZHNY-EMV Wed Feb 15 10:08:44 2012 diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index e0dfec065a..21301950f5 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -735,7 +735,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo) } // BOPTools_AlgoTools2D::CurveOnSurface (anEdge, myFace, aC2D, - aFirst, aLast, aToler, Standard_True); + aFirst, aLast, aToler); dt=2.*Tolerance2D(aV, aGAS); // //modified by NIZHNY-EMV Wed Aug 03 11:34:58 2011 @@ -851,7 +851,7 @@ Standard_Real Angle (const gp_Dir2d& aDir2D) aIt.Initialize(myEdges); for(; aIt.More(); aIt.Next()) { const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value()); - BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aTolE, Standard_True); + BOPTools_AlgoTools2D::CurveOnSurface(aE, myFace, aC2D, aTolE); aBB.UpdateEdge(aE, aC2D, myFace, aTolE); } } diff --git a/src/BOPTest/BOPTest_CheckCommands.cxx b/src/BOPTest/BOPTest_CheckCommands.cxx index 362a7d5b56..698bbbc310 100644 --- a/src/BOPTest/BOPTest_CheckCommands.cxx +++ b/src/BOPTest/BOPTest_CheckCommands.cxx @@ -99,7 +99,6 @@ Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char BOPAlgo_CheckerSI aChecker; BOPCol_ListOfShape anArgs; anArgs.Append(aS); - anArgs.Append(aS); aChecker.SetArguments(anArgs); // aChecker.Perform(); diff --git a/src/BOPTools/BOPTools_AlgoTools.cxx b/src/BOPTools/BOPTools_AlgoTools.cxx index 8ae6e55860..effc76fa4d 100644 --- a/src/BOPTools/BOPTools_AlgoTools.cxx +++ b/src/BOPTools/BOPTools_AlgoTools.cxx @@ -1338,7 +1338,7 @@ static BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aFFWD); BOPTools_AlgoTools2D::CurveOnSurface(aE, aFFWD, aC2D, aOutFirst, aOutLast, - aOutTol, Standard_True); + aOutTol); } // if (aC3DE->IsPeriodic()) { diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cdl b/src/BOPTools/BOPTools_AlgoTools2D.cdl index 74c2bc7b8a..fda77b18d5 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cdl +++ b/src/BOPTools/BOPTools_AlgoTools2D.cdl @@ -65,13 +65,11 @@ is aE: Edge from TopoDS; aF: Face from TopoDS; aC : out Curve from Geom2d; - aToler: out Real from Standard; - aTrim3d:Boolean from Standard); + aToler: out Real from Standard); ---Purpose: --- Get P-Curve for the edge on surface . --- If the P-Curve does not exist, build it using Make2D(). --- [aToler] - reached tolerance - --- [aTrim3d] - trimming flag. --- CurveOnSurface (myclass; aE: Edge from TopoDS; @@ -79,15 +77,13 @@ is aC : out Curve from Geom2d; aFirst: out Real from Standard; aLast : out Real from Standard; - aToler: out Real from Standard; - aTrim3d:Boolean from Standard); + aToler: out Real from Standard); ---Purpose: --- Get P-Curve for the edge on surface . --- If the P-Curve does not exist, build it using Make2D(). --- [aFirst, aLast] - range of the P-Curve --- [aToler] - reached tolerance - --- [aTrim3d] - trimming flag. --- HasCurveOnSurface (myclass; aE: Edge from TopoDS; @@ -156,13 +152,11 @@ is aC : out Curve from Geom2d; aFirst: out Real from Standard; aLast : out Real from Standard; - aToler: out Real from Standard; - aTrim3d:Boolean from Standard); + aToler: out Real from Standard); ---Purpose: --- Make P-Curve for the edge on surface . --- [aFirst, aLast] - range of the P-Curve --- [aToler] - reached tolerance - --- [aTrim3d] - trimming flag. --- MakeCurveOnSurface (myclass; @@ -171,8 +165,7 @@ is aC : out Curve from Geom2d; aFirst: out Real from Standard; aLast : out Real from Standard; - aToler: out Real from Standard; - aTrim3d:Boolean from Standard); + aToler: out Real from Standard); ---Purpose: --- Same as Make2D() --- diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx index 93bd916ad4..ce2ed21278 100755 --- a/src/BOPTools/BOPTools_AlgoTools2D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx @@ -81,7 +81,7 @@ static } - BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC, Standard_True); + BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolPC); aTolEdge=BRep_Tool::Tolerance(aE); @@ -141,7 +141,7 @@ static Handle(Geom2d_Curve) aC2D; Standard_Real aToler, aFirst, aLast; - BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, Standard_True); + BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler); aC2D->D0(aParameter, aP2D); U=aP2D.X(); V=aP2D.Y(); @@ -155,12 +155,11 @@ static void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE, const TopoDS_Face& aF, Handle(Geom2d_Curve)& aC2D, - Standard_Real& aToler, - const Standard_Boolean trim3d) + Standard_Real& aToler) { Standard_Real aFirst, aLast; - BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler, trim3d); + BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler); return; } @@ -173,8 +172,7 @@ static Handle(Geom2d_Curve)& aC2D, Standard_Real& aFirst, Standard_Real& aLast, - Standard_Real& aToler, - const Standard_Boolean trim3d) + Standard_Real& aToler) { Standard_Boolean aHasOld; Handle(Geom2d_Curve) C2D; @@ -185,7 +183,7 @@ static return; } - BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler, trim3d); + BOPTools_AlgoTools2D::Make2D(aE, aF, C2D, aFirst, aLast, aToler); aC2D=C2D; return; } @@ -431,7 +429,7 @@ static return; } // - BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE, Standard_True); + BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE); aBB.UpdateEdge(aE, aC2D, aF, aTolE); // return; @@ -446,8 +444,7 @@ static Handle(Geom2d_Curve)& aC2D, Standard_Real& aFirst, Standard_Real& aLast, - Standard_Real& aToler, - const Standard_Boolean trim3d) + Standard_Real& aToler) { Standard_Boolean aLocIdentity; Standard_Real f3d, l3d; @@ -463,7 +460,7 @@ static return; } - Handle(Geom_Curve) C3D3, C3D2, C3D; + Handle(Geom_Curve) C3D2, C3D; C3D = BRep_Tool::Curve(aE, aLoc, f3d, l3d); // if (C3D.IsNull()) { @@ -480,17 +477,9 @@ static DownCast(C3D->Transformed(aLoc.Transformation())); } - if (trim3d) { - - C3D3=C3D2; - } - - else { - C3D3=C3D2; - } // aToler=.5*BRep_Tool::Tolerance(aE); - BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D3, f3d, l3d, aC2D, aToler); + BOPTools_AlgoTools2D::MakePCurveOnFace(aF, C3D2, f3d, l3d, aC2D, aToler); // aFirst = f3d; aLast = l3d; @@ -693,10 +682,9 @@ Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E) Handle(Geom2d_Curve)& aC2D, Standard_Real& aFirst, Standard_Real& aLast, - Standard_Real& aToler, - const Standard_Boolean trim3d) + Standard_Real& aToler) { - BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler, trim3d); + BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler); } //======================================================================= diff --git a/src/BOPTools/BOPTools_AlgoTools3D.cxx b/src/BOPTools/BOPTools_AlgoTools3D.cxx index e1513e89d7..3a445c1e99 100644 --- a/src/BOPTools/BOPTools_AlgoTools3D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools3D.cxx @@ -235,7 +235,7 @@ static Handle(Geom_Surface) aS1=BRep_Tool::Surface(aF1); Handle(Geom2d_Curve)aC2D1; - BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC, Standard_True); + BOPTools_AlgoTools2D::CurveOnSurface(aE, aF1, aC2D1, aTolPC); aC2D1->D0(aT, aP2D); U=aP2D.X(); -- 2.39.5