mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030422: Random behaviour of BRepAdaptor_CompCurve
BRepTools/BRepTools_WireExplorer.cxx - replace MapOfShape vmap by IndexedMapOfShape to avoid random behavior of algorithm bugs/moddata_3/bug30422 - new test case added
This commit is contained in:
parent
1e6b2065b5
commit
e2421df543
@ -226,7 +226,7 @@ void BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// map of vertices to know if the wire is open
|
// map of vertices to know if the wire is open
|
||||||
TopTools_MapOfShape vmap;
|
TopTools_IndexedMapOfShape vmap;
|
||||||
// map of infinite edges
|
// map of infinite edges
|
||||||
TopTools_MapOfShape anInfEmap;
|
TopTools_MapOfShape anInfEmap;
|
||||||
|
|
||||||
@ -254,15 +254,23 @@ void BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
|
|||||||
|
|
||||||
// add or remove in the vertex map
|
// add or remove in the vertex map
|
||||||
V1.Orientation(TopAbs_FORWARD);
|
V1.Orientation(TopAbs_FORWARD);
|
||||||
if (!vmap.Add(V1))
|
Standard_Integer currsize = vmap.Extent(),
|
||||||
vmap.Remove(V1);
|
ind = vmap.Add(V1);
|
||||||
|
if (currsize >= ind)
|
||||||
|
{
|
||||||
|
vmap.RemoveKey(V1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!V2.IsNull())
|
if (!V2.IsNull())
|
||||||
{
|
{
|
||||||
V2.Orientation(TopAbs_REVERSED);
|
V2.Orientation(TopAbs_REVERSED);
|
||||||
if (!vmap.Add(V2))
|
Standard_Integer currsize = vmap.Extent(),
|
||||||
vmap.Remove(V2);
|
ind = vmap.Add(V2);
|
||||||
|
if (currsize >= ind)
|
||||||
|
{
|
||||||
|
vmap.RemoveKey(V2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (V1.IsNull() || V2.IsNull())
|
if (V1.IsNull() || V2.IsNull())
|
||||||
@ -295,12 +303,21 @@ void BRepTools_WireExplorer::Init(const TopoDS_Wire& W,
|
|||||||
|
|
||||||
// if vmap is not empty the wire is open, let us find the first vertex
|
// if vmap is not empty the wire is open, let us find the first vertex
|
||||||
if (!vmap.IsEmpty()) {
|
if (!vmap.IsEmpty()) {
|
||||||
TopTools_MapIteratorOfMapOfShape itt(vmap);
|
//TopTools_MapIteratorOfMapOfShape itt(vmap);
|
||||||
while (itt.Key().Orientation() != TopAbs_FORWARD) {
|
//while (itt.Key().Orientation() != TopAbs_FORWARD) {
|
||||||
itt.Next();
|
// itt.Next();
|
||||||
if (!itt.More()) break;
|
// if (!itt.More()) break;
|
||||||
|
//}
|
||||||
|
//if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
|
||||||
|
Standard_Integer ind = 0;
|
||||||
|
for (ind = 1; ind <= vmap.Extent(); ++ind)
|
||||||
|
{
|
||||||
|
if (vmap(ind).Orientation() == TopAbs_FORWARD)
|
||||||
|
{
|
||||||
|
V1 = TopoDS::Vertex(vmap(ind));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (itt.More()) V1 = TopoDS::Vertex(itt.Key());
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The wire is infinite Try to find the first vertex. It may be NULL.
|
// The wire is infinite Try to find the first vertex. It may be NULL.
|
||||||
|
56
tests/bugs/moddata_3/bug30422
Normal file
56
tests/bugs/moddata_3/bug30422
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
puts "========="
|
||||||
|
puts "0030422: Modeling Data - Random behaviour of BRepAdaptor_CompCurve"
|
||||||
|
puts "========="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
vertex vf1 0 0 0
|
||||||
|
vertex vf2 1 0 0
|
||||||
|
vertex vf3 2 0 0
|
||||||
|
vertex vf4 3 0 0
|
||||||
|
vertex vf5 4 0 0
|
||||||
|
##
|
||||||
|
edge ef1 vf1 vf2
|
||||||
|
edge ef2 vf2 vf3
|
||||||
|
edge ef3 vf3 vf4
|
||||||
|
edge ef4 vf5 vf4
|
||||||
|
##
|
||||||
|
shape wf w
|
||||||
|
add ef1 wf
|
||||||
|
add ef2 wf
|
||||||
|
add ef3 wf
|
||||||
|
add ef4 wf
|
||||||
|
##
|
||||||
|
wexplo wf
|
||||||
|
#
|
||||||
|
if {![isdraw WEDGE_3] } {
|
||||||
|
puts "Error: wire explorer failed"
|
||||||
|
} else {
|
||||||
|
unset WEDGE_1
|
||||||
|
unset WEDGE_2
|
||||||
|
unset WEDGE_3
|
||||||
|
}
|
||||||
|
##
|
||||||
|
vertex vs5 4 0 0
|
||||||
|
vertex vs2 1 0 0
|
||||||
|
vertex vs3 2 0 0
|
||||||
|
vertex vs4 3 0 0
|
||||||
|
vertex vs1 0 0 0
|
||||||
|
##
|
||||||
|
edge es1 vs1 vs2
|
||||||
|
edge es2 vs2 vs3
|
||||||
|
edge es3 vs3 vs4
|
||||||
|
edge es4 vs5 vs4
|
||||||
|
##
|
||||||
|
shape ws w
|
||||||
|
add es1 ws
|
||||||
|
add es4 ws
|
||||||
|
add es3 ws
|
||||||
|
add es2 ws
|
||||||
|
##
|
||||||
|
wexplo ws
|
||||||
|
#
|
||||||
|
if {![isdraw WEDGE_3] } {
|
||||||
|
puts "Error: wire explorer failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user