1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0030522: Modeling Algorithms - BRepBuilderAPI_MakeWire produces different wires depending on the order of parameters

The following improvements have been implemented in BRepLib_MakeWire class to make it more reliable:
1. Quit adding edges of a wire into result if the current edges have not been added. Return NotDone status.
2. Allow merging not only bounding vertices (connected to only one edge) but also the middle ones, so the multi-connected vertices may appear in the result.

Test case for the issue.
This commit is contained in:
emv
2019-02-26 14:06:30 +03:00
committed by apn
parent aff73fd598
commit d84b49c743
4 changed files with 47 additions and 21 deletions

View File

@@ -131,10 +131,10 @@ BRepLib_MakeWire::BRepLib_MakeWire(const TopoDS_Wire& W,
void BRepLib_MakeWire::Add(const TopoDS_Wire& W)
{
TopExp_Explorer ex(W,TopAbs_EDGE);
while (ex.More()) {
Add(TopoDS::Edge(ex.Current()));
ex.Next();
for (TopoDS_Iterator it(W); it.More(); it.Next()) {
Add(TopoDS::Edge(it.Value()));
if (myError != BRepLib_WireDone)
break;
}
}

View File

@@ -24,10 +24,10 @@
#include <BRepLib_WireError.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepLib_MakeShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <NCollection_Map.hxx>
#include <Bnd_Box.hxx>
#include <NCollection_UBTree.hxx>
@@ -172,14 +172,14 @@ private:
};
void CollectCoincidentVertices(const TopTools_ListOfShape& theL,
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL);
void CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV);
TopTools_DataMapOfShapeShape& theO2NV);
void CreateNewListOfEdges(const TopTools_ListOfShape& theL,
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
TopTools_ListOfShape& theNewEList);
const TopTools_DataMapOfShapeShape& theO2NV,
TopTools_ListOfShape& theNewEList);
void Add(const TopoDS_Edge& E, Standard_Boolean IsCheckGeometryProximity);

View File

@@ -58,7 +58,7 @@ void BRepLib_MakeWire::Add(const TopTools_ListOfShape& L)
CollectCoincidentVertices(L, aGrVL);
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex> anO2NV;
TopTools_DataMapOfShapeShape anO2NV;
CreateNewVertices(aGrVL, anO2NV);
@@ -188,17 +188,13 @@ void BRepLib_MakeWire::CollectCoincidentVertices(const TopTools_ListOfShape& the
NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL)
{
TopTools_IndexedMapOfShape anAllV;
TopTools_ListIteratorOfListOfShape anItL;
TopTools_IndexedDataMapOfShapeListOfShape aMV2EL;
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMV2EL);
TopExp_Explorer exp;
for (anItL.Initialize(theL); anItL.More(); anItL.Next())
TopExp::MapShapesAndAncestors(anItL.Value(), TopAbs_VERTEX, TopAbs_EDGE, aMV2EL);
TopExp::MapShapes(myShape, TopAbs_VERTEX, anAllV);
for (int i = 1; i <= aMV2EL.Extent(); i++)
if (aMV2EL(i).Extent() == 1)
anAllV.Add(aMV2EL.FindKey(i));
TopTools_ListIteratorOfListOfShape anItL(theL);
for (; anItL.More(); anItL.Next())
TopExp::MapShapes(anItL.Value(), TopAbs_VERTEX, anAllV);
//aV2CV : vertex <-> its coincident vertices
NCollection_DataMap<TopoDS_Vertex, NCollection_Map<TopoDS_Vertex>> aV2CV;
@@ -303,8 +299,8 @@ void BRepLib_MakeWire::CollectCoincidentVertices(const TopTools_ListOfShape& the
//function : CreateNewVertices
//purpose :
//=======================================================================
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV)
void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List<TopoDS_Vertex>>& theGrVL,
TopTools_DataMapOfShapeShape& theO2NV)
{
//map [old vertex => new vertex]
//note that already existing shape (i.e. the original ones)
@@ -356,7 +352,7 @@ void BRepLib_MakeWire::CreateNewVertices(const NCollection_List<NCollection_List
//purpose :
//=======================================================================
void BRepLib_MakeWire::CreateNewListOfEdges(const TopTools_ListOfShape& theL,
const NCollection_DataMap<TopoDS_Vertex, TopoDS_Vertex>& theO2NV,
const TopTools_DataMapOfShapeShape& theO2NV,
TopTools_ListOfShape& theNewEList)
{
///create the new list (theNewEList) from the input list L