InitF2.ShapeType() == TopAbs_FACE);
TopTools_ListOfShape LE,LV;
LInt1.Clear(); LInt2.Clear();
- if (BRepOffset_Tool::HasCommonShapes(F1,F2,LE,LV) ||
+ if (BRepOffset_Tool::FindCommonShapes(F1,F2,LE,LV) ||
myAsDes->HasCommonDescendant(F1,F2,LE)) {
//-------------------------------------------------
// F1 and F2 share shapes.
// many sections.
//--------------------------------------------------------
if (InterFaces) {
- if (BRepOffset_Tool::HasCommonShapes(TopoDS::Face(InitF1),
- TopoDS::Face(InitF2),LE,LV)) {
+ if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
+ TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge);
}
else if ( Type1 == TopAbs_FACE && Type2 == TopAbs_FACE) {
// if two root faces are tangent in
// the initial shape, they will be tangent in the offset shape
- TopTools_ListOfShape LE,LV;
- BRepOffset_Tool::HasCommonShapes(TopoDS::Face(Root1),
- TopoDS::Face(Root2),
- LE,LV);
- if ( LE.Extent() == 1) {
+ TopTools_ListOfShape LE;
+ BRepOffset_Tool::FindCommonShapes(Root1, Root2, TopAbs_EDGE, LE);
+ if ( LE.Extent() == 1) {
const TopoDS_Edge& Ed = TopoDS::Edge(LE.First());
if ( myAnalyse.HasAncestor(Ed)) {
const BRepOffset_ListOfInterval& LI = myAnalyse.Type(Ed);
}
else if ( Type1 == TopAbs_EDGE && Type2 == TopAbs_EDGE) {
TopTools_ListOfShape LV;
- TopExp_Explorer exp1;
- for (exp1.Init(Root1,TopAbs_VERTEX); exp1.More(); exp1.Next()) {
- TopExp_Explorer exp2(F2,TopAbs_EDGE);
- for (exp2.Init(Root2,TopAbs_VERTEX); exp2.More(); exp2.Next()) {
- if (exp1.Current().IsSame(exp2.Current())) {
- LV.Append(exp1.Current());
- }
- }
- }
+ BRepOffset_Tool::FindCommonShapes(Root1, Root2, TopAbs_VERTEX, LV);
if ( LV.Extent() == 1) {
TopTools_ListOfShape LEdTg;
myAnalyse.TangentEdges(TopoDS::Edge(Root1),
}
//=======================================================================
-//function : HasCommonShape
+//function : FindCommonShapes
//purpose :
//=======================================================================
+Standard_Boolean BRepOffset_Tool::FindCommonShapes(const TopoDS_Face& theF1,
+ const TopoDS_Face& theF2,
+ TopTools_ListOfShape& theLE,
+ TopTools_ListOfShape& theLV)
+{
+ Standard_Boolean bFoundEdges =
+ FindCommonShapes(theF1, theF2, TopAbs_EDGE, theLE);
+ Standard_Boolean bFoundVerts =
+ FindCommonShapes(theF1, theF2, TopAbs_VERTEX, theLV);
+ return bFoundEdges || bFoundVerts;
+}
-Standard_Boolean BRepOffset_Tool::HasCommonShapes (const TopoDS_Face& F1,
- const TopoDS_Face& F2,
- TopTools_ListOfShape& LE,
- TopTools_ListOfShape& LV)
+//=======================================================================
+//function : FindCommonShapes
+//purpose :
+//=======================================================================
+Standard_Boolean BRepOffset_Tool::FindCommonShapes(const TopoDS_Shape& theS1,
+ const TopoDS_Shape& theS2,
+ const TopAbs_ShapeEnum theType,
+ TopTools_ListOfShape& theLSC)
{
- Standard_Boolean Common = Standard_False;
- LE.Clear(); LV.Clear();
-
- TopExp_Explorer exp1;
- exp1.Init(F1,TopAbs_EDGE);
-
- for (; exp1.More(); exp1.Next()) {
- TopExp_Explorer exp2;
- exp2.Init(F2,TopAbs_EDGE);
- for (; exp2.More(); exp2.Next()) {
- if (exp1.Current().IsSame(exp2.Current())) {
- Common = Standard_True;
- LE.Append(exp1.Current());
- }
- }
+ theLSC.Clear();
+ //
+ TopTools_MapOfShape aMS;
+ TopExp_Explorer aExp(theS1, theType);
+ for (; aExp.More(); aExp.Next()) {
+ aMS.Add(aExp.Current());
+ }
+ //
+ if (aMS.IsEmpty()) {
+ return Standard_False;
}
- for (exp1.Init(F1,TopAbs_VERTEX); exp1.More(); exp1.Next()) {
- TopExp_Explorer exp2;
- exp2.Init(F2,TopAbs_EDGE);
- for (exp2.Init(F2,TopAbs_VERTEX); exp2.More(); exp2.Next()) {
- if (exp1.Current().IsSame(exp2.Current())) {
- Common = Standard_True;
- LV.Append(exp1.Current());
+ //
+ TopTools_MapOfShape aMFence;
+ aExp.Init(theS2, theType);
+ for (; aExp.More(); aExp.Next()) {
+ const TopoDS_Shape& aS2 = aExp.Current();
+ if (aMS.Contains(aS2)) {
+ if (aMFence.Add(aS2)) {
+ theLSC.Append(aS2);
}
}
}
- return Common;
+ //
+ return !theLSC.IsEmpty();
}
//=======================================================================
//! idem for <O2>.
Standard_EXPORT static void OrientSection (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, TopAbs_Orientation& O1, TopAbs_Orientation& O2);
- //! Returns True if <F1> and <F2> has common Vertices
- //! or edges , <LE> contains the common edges. <LV> the
- //! common vertices.
- Standard_EXPORT static Standard_Boolean HasCommonShapes (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LE, TopTools_ListOfShape& LV);
-
+ //! Looks for the common Vertices and Edges between faces <theF1> and <theF2>.<br>
+ //! Returns TRUE if common shapes have been found.<br>
+ //! <theLE> will contain the found common edges;<br>
+ //! <theLV> will contain the found common vertices.
+ Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Face& theF1,
+ const TopoDS_Face& theF2,
+ TopTools_ListOfShape& theLE,
+ TopTools_ListOfShape& theLV);
+
+ //! Looks for the common shapes of type <theType> between shapes <theS1> and <theS2>.<br>
+ //! Returns TRUE if common shapes have been found.<br>
+ //! <theLSC> will contain the found common shapes.
+ Standard_EXPORT static Standard_Boolean FindCommonShapes(const TopoDS_Shape& theS1,
+ const TopoDS_Shape& theS2,
+ const TopAbs_ShapeEnum theType,
+ TopTools_ListOfShape& theLSC);
+
//! Computes the Section betwwen <F1> and <F2> the
//! edges solution are stored in <LInt1> with the
//! orientation on <F1>, the sames edges are stored in