From: emv Date: Tue, 14 Jun 2016 13:13:39 +0000 (+0300) Subject: BRepOffset_Analyse::Perform() - Added processing of the cases when more than two... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=e9f8cd1d69f390676913b2fc8c0d40de1ef55686;p=occt-copy.git BRepOffset_Analyse::Perform() - Added processing of the cases when more than two faces share the same edge. BRepOffset_MakeOffset - Added protection from the Infinite edges. BOPAlgo_PaveFiller::MakeSplitEdges() - Remove PaveBlocks with same parameters on paves. BOPAlgo_PaveFiller::PerformVE() - Added protection from edges with no PaveBlocks. --- diff --git a/src/BOPAlgo/BOPAlgo_Builder_1.cxx b/src/BOPAlgo/BOPAlgo_Builder_1.cxx index fd628c7500..8688c16bd2 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_1.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_1.cxx @@ -89,7 +89,9 @@ const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value(); const Handle(BOPDS_PaveBlock)& aPBR=myDS->RealPaveBlock(aPB); // - nSpR=aPBR->Edge(); + if (!aPBR->HasEdge(nSpR)) { + continue; + } const TopoDS_Shape& aSpR=myDS->Shape(nSpR); aLS.Append(aSpR); myOrigins.Bind(aSpR, aE); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx index 69cfa25e38..2008f76ecc 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx @@ -185,6 +185,11 @@ void BOPAlgo_PaveFiller::PerformVE() continue; } // + BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE); + if (aLPB.IsEmpty()) { + continue; + } + // const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape())); const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx))); // @@ -217,8 +222,8 @@ void BOPAlgo_PaveFiller::PerformVE() // 2 myDS->AddInterf(nV, nE); // 3 - BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE); - Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First()); + const BOPDS_ListOfPaveBlock& aLPB=myDS->PaveBlocks(nE); + const Handle(BOPDS_PaveBlock)& aPB=*((Handle(BOPDS_PaveBlock)*)&aLPB.First()); // aPave.SetIndex(nVx); aPave.SetParameter(aT); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index 07a16ee7ee..983f38f3c3 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -360,7 +360,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() } // aItPB.Initialize(aLPB); - for (; aItPB.More(); aItPB.Next()) { + for (; aItPB.More(); ) { aPB=aItPB.Value(); const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB); bCB=!aCB.IsNull(); @@ -369,10 +369,15 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() aPB=aCB->PaveBlock1(); } // + aPB->Range(aT1, aT2); + if (aT2 - aT1 < Precision::PConfusion()) { + aLPB.Remove(aItPB); + continue; + } + // if (aMPB.Add(aPB)) { nE=aPB->OriginalEdge(); aPB->Indices(nV1, nV2); - aPB->Range(aT1, aT2); // aE=(*(TopoDS_Edge *)(&myDS->Shape(nE))); aE.Orientation(TopAbs_FORWARD); @@ -392,6 +397,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges() } aBSE.SetProgressIndicator(myProgressIndicator); } + aItPB.Next(); } // for (; aItPB.More(); aItPB.Next()) { } // for (i=0; i #include #include +#include #include #include #include @@ -528,26 +529,42 @@ void BRepOffset_Inter3d::ConnexIntByInt continue; } // - BRepOffset_Type OT = L.First().Type(); - if (OT != BRepOffset_Convex && OT != BRepOffset_Concave) { + BRepOffset_Type OT = L.First().Type(); + BRepOffset_ListIteratorOfListOfInterval aItInt(L); + for (; aItInt.More(); aItInt.Next()) { + OT = aItInt.Value().Type(); + if (OT == BRepOffset_Convex || OT == BRepOffset_Concave) { + break; + } + } + // + if (!aItInt.More()) { continue; } // + // if (OT == BRepOffset_Concave) CurSide = TopAbs_IN; else CurSide = TopAbs_OUT; //----------------------------------------------------------- // edge is of the proper type, return adjacent faces. //----------------------------------------------------------- const TopTools_ListOfShape& Anc = Analyse.Ancestors(E); - if (Anc.Extent() != 2) { + if (Anc.Extent() < 2) { continue; } // - F1 = TopoDS::Face(Anc.First()); - F2 = TopoDS::Face(Anc.Last()); - // - aLF1.Append(F1); - aLF2.Append(F2); + it.Initialize(Anc); + for (; it.More(); it.Next()) { + F1 = TopoDS::Face(it.Value()); + // + it1 = it; + for (it1.Next(); it1.More(); it1.Next()) { + F2 = TopoDS::Face(it1.Value()); + // + aLF1.Append(F1); + aLF2.Append(F2); + } + } } else { if (!aDMVLF1.IsBound(aS)) { diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx index a821c3e2b0..ed388d1ae5 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx @@ -1403,10 +1403,11 @@ const TopoDS_Shape& BRepOffset_MakeOffset::Shape() const //purpose : Trim the edge of the largest of descendants in AsDes2d. // Order in AsDes two vertices that have trimmed the edge. //======================================================================= -void TrimEdge(TopoDS_Edge& NE, - const Handle(BRepAlgo_AsDes)& AsDes2d, - Handle(BRepAlgo_AsDes)& AsDes, - TopTools_DataMapOfShapeShape& theETrimEInf) +static + Standard_Boolean TrimEdge(TopoDS_Edge& NE, + const Handle(BRepAlgo_AsDes)& AsDes2d, + Handle(BRepAlgo_AsDes)& AsDes, + TopTools_DataMapOfShapeShape& theETrimEInf) { TopoDS_Edge aSourceEdge; TopoDS_Vertex V1,V2; @@ -1490,6 +1491,7 @@ void TrimEdge(TopoDS_Edge& NE, theETrimEInf.Bind(NE, aSourceEdge); } } + return bTrim; } //======================================================================= @@ -4076,12 +4078,13 @@ void TrimEdges(const TopoDS_Shape& theShape, theEdgesOrigins.Bind(NE, aLSx); } // + Standard_Boolean bTrimmed = Standard_True; if (theMES.IsBound(NE)) { NE = theMES(NE); NE.Orientation(aS.Orientation()); if (theNewEdges.Add(NE)) { - TrimEdge (TopoDS::Edge(NE), theAsDes2d, theAsDes, theETrimEInf); + bTrimmed = TrimEdge (TopoDS::Edge(NE), theAsDes2d, theAsDes, theETrimEInf); } } else { @@ -4093,7 +4096,9 @@ void TrimEdges(const TopoDS_Shape& theShape, theETrimEInf.Bind(anEdge, aNewEdge); } } - theAsDes->Add(NF, NE); + if (bTrimmed) { + theAsDes->Add(NF, NE); + } } } } @@ -7684,8 +7689,13 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE, TopoDS_Vertex aV1, aV2; TopExp::Vertices(TopoDS::Edge(aE), aV1, aV2); // - aGFE.AddArgument(aV1); - aGFE.AddArgument(aV2); + if (!aV1.IsNull()) { + aGFE.AddArgument(aV1); + } + // + if (!aV2.IsNull()) { + aGFE.AddArgument(aV2); + } // aGFE.Perform(); // @@ -7731,7 +7741,14 @@ void TrimNewIntersectionEdges(const TopTools_ListOfShape& theLE, // TopExp_Explorer aExp(aCEIm, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Shape& aEIm = aExp.Current(); + const TopoDS_Edge& aEIm = TopoDS::Edge(aExp.Current()); + // + // check the split to be trimmed + Standard_Real aFirst, aLast; + BRep_Tool::Range(aEIm, aFirst, aLast); + if (Precision::IsInfinite(aFirst) || Precision::IsInfinite(aLast)) { + continue; + } // // check the split not to contain bounding vertices TopExp_Explorer aExpV(aEIm, TopAbs_VERTEX);