const TopTools_ListOfShape* pEOrigins = myOEOrigins.Seek (aE);
if (!pEOrigins)
{
- theMEUseInRebuild.Add (aE);
continue;
}
}
}
+
+namespace
+{
+//=======================================================================
+//function : mapShapes
+//purpose : Collect theVecShapes into theMap with setted theType
+//=======================================================================
+ template<class Container>
+ static void mapShapes (const Container& theVecShapes,
+ const TopAbs_ShapeEnum theType,
+ TopTools_MapOfShape& theMap)
+ {
+ for (const auto& aShape : theVecShapes)
+ {
+ for (TopExp_Explorer anExp(aShape, theType); anExp.More(); anExp.Next())
+ {
+ theMap.Add(anExp.Current());
+ }
+ }
+ }
+}
+
+
//=======================================================================
//function : IntersectFaces
//purpose : Intersection of the faces that should be rebuild to resolve all invalidities
TopoDS_Compound aCBE;
aBB.MakeCompound (aCBE);
//
- TopExp_Explorer aExp (aCBInv, TopAbs_EDGE);
+ // remember inside edges and vertices to further check
+ TopTools_MapOfShape anInsideEdges;
+ TopTools_MapOfShape anInsideVertices;
+ TopExp_Explorer aExp(aCBInv, TopAbs_EDGE);
for (; aExp.More(); aExp.Next())
{
const TopoDS_Shape& aE = aExp.Current();
if (aMEFence.Add (aE))
{
aBB.Add (aCBE, aE);
+ if (!myEdgesToAvoid.Contains(aE) && myInvalidEdges.Contains(aE))
+ {
+ anInsideEdges.Add(aE);
+ TopoDS_Iterator anIt(aE);
+ for (; anIt.More(); anIt.Next())
+ {
+ anInsideVertices.Add(anIt.Value());
+ }
+ }
}
}
}
TopExp::MapShapes (aCBELoc, TopAbs_EDGE, aME);
aMECV = aME;
TopExp::MapShapes (aCBELoc, TopAbs_VERTEX, aME);
- //
- // Using the map <aME> find chain of faces to be intersected;
- //
- // faces for intersection
TopTools_IndexedMapOfShape aMFInt;
// additional faces for intersection
TopTools_IndexedMapOfShape aMFIntExt;
if (pMFInter && !pInterFi)
continue;
+ // create map of edges and vertices for aLFImi
+ TopTools_MapOfShape aMEVIm;
+ mapShapes(*aLFImi, TopAbs_EDGE, aMEVIm);
+ mapShapes(*aLFImi, TopAbs_VERTEX, aMEVIm);
+
+ Standard_Boolean isIContainsE = aMEVIm.HasIntersection(anInsideEdges);
+ Standard_Boolean isIContainsV = aMEVIm.HasIntersection(anInsideVertices);
+
for (j = i + 1; j <= aNb; ++j)
{
const TopoDS_Face& aFj = TopoDS::Face (aMFInt (j));
if (!aLFEj)
continue;
+ // create map of edges and vertices for aLFImi
+ aMEVIm.Clear();
+ mapShapes(*aLFImj, TopAbs_EDGE, aMEVIm);
+ mapShapes(*aLFImj, TopAbs_VERTEX, aMEVIm);
+ // check images of both faces contain anInsideEdges and anInsideVertices
+ // not process if false and true
+ Standard_Boolean isJContainsE = aMEVIm.HasIntersection(anInsideEdges);
+ Standard_Boolean isJContainsV = aMEVIm.HasIntersection(anInsideVertices);
+
+ // Check if one face is connected to inside edge then
+ // the other must be also connected
+ if ((isIContainsE && !isJContainsV) ||
+ (isJContainsE && !isIContainsV))
+ {
+ TopTools_ListOfShape aLVC;
+ // it is necessary to process the images if they already have
+ // common vertices
+ FindCommonParts(*aLFImi, *aLFImj, aLVC, TopAbs_VERTEX);
+
+ if (aLVC.IsEmpty())
+ continue;
+ }
//
// if there are some common edges between faces
// we should use these edges and do not intersect again.