From d8f5bd550370d1b477745d6a6a19b188ac94ca50 Mon Sep 17 00:00:00 2001 From: emv Date: Tue, 15 Mar 2016 17:14:31 +0300 Subject: [PATCH] BRepOffset_MakeOffset::IntersectFaces() - When treating invalid faces intersect only the faces that are close to invalidity. --- src/BRepOffset/BRepOffset_MakeOffset.cxx | 40 +++++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx index 555bf151d3..05bff3a230 100644 --- a/src/BRepOffset/BRepOffset_MakeOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx @@ -4994,21 +4994,20 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui } // // Collect vertices to avoid while trimming the edges - TopTools_MapOfShape aMVInv, aMVRInv; + TopTools_MapOfShape aMVInv, aMVRInv, aMVInvAll; // // get vertices from invalid edges aNbInv = theInvEdges.Extent(); for (i = 1; i <= aNbInv; ++i) { const TopoDS_Shape& aEInv = theInvEdges(i); - // - if (theValidEdges.Contains(aEInv)) { - continue; - } - // + Standard_Boolean bValid = theValidEdges.Contains(aEInv); TopExp_Explorer aExp(aEInv, TopAbs_VERTEX); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aV = aExp.Current(); - aMVInv.Add(aV); + aMVInvAll.Add(aV); + if (!bValid) { + aMVInv.Add(aV); + } } } // @@ -5109,18 +5108,31 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui // // Using the map find chain of faces to be intersected; TopTools_ListOfShape aLFInt; - TopTools_IndexedMapOfShape aMFInt; + TopTools_IndexedMapOfShape aMFInt, aMFAvoid; Standard_Integer aNbE = aME.Extent(); for (i = 1; i <= aNbE; ++i) { - const TopoDS_Shape& aE = aME(i); - if (aDMEF.IsBound(aE)) { - const TopTools_ListOfShape& aLF = aDMEF.Find(aE); + const TopoDS_Shape& aS = aME(i); + if (aDMEF.IsBound(aS)) { + const TopTools_ListOfShape& aLF = aDMEF.Find(aS); aItLE.Initialize(aLF); for (; aItLE.More(); aItLE.Next()) { const TopoDS_Shape& aF = aItLE.Value(); if (!aMFInt.Contains(aF)) { + const TopTools_ListOfShape& aLFIm = theDMFFIm.FindFromKey(aF); + // check if this face is close to invalidity + if (theArtInvFaces.IsBound(aFInv) && theArtInvFaces.IsBound(aF)) { + if (aS.ShapeType() != TopAbs_EDGE && !aMVInvAll.Contains(aS)) { + aMFAvoid.Add(aF); + } + } + // aMFInt.Add(aF); - aLFInt.Append(aF); + // Debug + TopTools_ListIteratorOfListOfShape aItLFIm(aLFIm); + for (; aItLFIm.More(); aItLFIm.Next()) { + const TopoDS_Shape& aFIm = aItLFIm.Value(); + aLFInt.Append(aFIm); + } } } } @@ -5303,6 +5315,10 @@ void IntersectFaces(const TopTools_IndexedDataMapOfShapeListOfShape& theFToRebui continue; } // + if (aMFAvoid.Contains(aFi) || aMFAvoid.Contains(aFj)) { + continue; + } + // aLFDone.Append(aFj); aMDone.ChangeFind(aFj).Append(aFi); // -- 2.39.5