mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0029695: Shape Healing - infinite loop in ShapeFix_IntersectionTool
Avoid splitting of wrong edge in ShapeFix_IntersectionTool. Added protection for case when index of edge to be split is out of range. Added test bugs heal bug29695
This commit is contained in:
parent
fc87027267
commit
ea1114eb85
@ -253,6 +253,8 @@ Standard_Boolean ShapeFix_IntersectionTool::SplitEdge1(const Handle(ShapeExtend_
|
|||||||
const Standard_Real preci,
|
const Standard_Real preci,
|
||||||
ShapeFix_DataMapOfShapeBox2d& boxes) const
|
ShapeFix_DataMapOfShapeBox2d& boxes) const
|
||||||
{
|
{
|
||||||
|
Standard_ASSERT_RETURN (num > 0 && num <= sewd->NbEdges(), "Edge index out of range", Standard_False);
|
||||||
|
|
||||||
TopoDS_Edge edge = sewd->Edge(num);
|
TopoDS_Edge edge = sewd->Edge(num);
|
||||||
TopoDS_Edge newE1, newE2;
|
TopoDS_Edge newE1, newE2;
|
||||||
if(!SplitEdge(edge,param,vert,face,newE1,newE2,preci)) return Standard_False;
|
if(!SplitEdge(edge,param,vert,face,newE1,newE2,preci)) return Standard_False;
|
||||||
@ -1801,24 +1803,22 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( akey1==0 && akey2==0 ) {
|
if( akey1==0 && akey2==0 ) {
|
||||||
|
int num1split2 = num1; // what edge to split by point 2
|
||||||
if(SplitEdge1(sewd1, face, num1, p11, NewV1, tolV1, boxes1)) {
|
if(SplitEdge1(sewd1, face, num1, p11, NewV1, tolV1, boxes1)) {
|
||||||
NbModif++;
|
NbModif++;
|
||||||
}
|
tmpE = sewd1->Edge (num1);
|
||||||
tmpE = sewd1->Edge(num1);
|
Standard_Real a, b;
|
||||||
Standard_Real a,b;
|
Handle (Geom2d_Curve) c2d;
|
||||||
Handle(Geom2d_Curve) c2d;
|
sae.PCurve (tmpE, face, c2d, a, b, Standard_False);
|
||||||
sae.PCurve(tmpE,face,c2d,a,b,Standard_False);
|
if ((a - p12)*(b - p12) > 0)
|
||||||
if( (a-p12)*(b-p12)>0 ) { // p12 - external for [a,b] => split next edge
|
{ // p12 - external for [a,b] => split next edge
|
||||||
if(SplitEdge1(sewd1, face, num1+1, p12, NewV2, tolV2, boxes1) ) {
|
num1split2++;
|
||||||
NbModif++;
|
|
||||||
numseg1=num1+1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (SplitEdge1 (sewd1, face, num1split2, p12, NewV2, tolV2, boxes1))
|
||||||
if(SplitEdge1(sewd1, face, num1, p12, NewV2, tolV2, boxes1) ) {
|
{
|
||||||
NbModif++;
|
NbModif++;
|
||||||
numseg1=num1+1;
|
numseg1=num1+1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SegE = sewd1->Edge(numseg1); // get edge from segment
|
SegE = sewd1->Edge(numseg1); // get edge from segment
|
||||||
@ -1885,25 +1885,23 @@ Standard_Boolean ShapeFix_IntersectionTool::FixIntersectingWires
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( akey1==0 && akey2==0 ) {
|
if( akey1==0 && akey2==0 ) {
|
||||||
|
int num2split2 = num2;
|
||||||
if(SplitEdge1(sewd2, face, num2, p21, NewV1, tolV1, boxes2)) {
|
if(SplitEdge1(sewd2, face, num2, p21, NewV1, tolV1, boxes2)) {
|
||||||
NbModif++;
|
NbModif++;
|
||||||
numseg2=num2+1;
|
numseg2=num2+1;
|
||||||
}
|
tmpE = sewd2->Edge (num2);
|
||||||
tmpE = sewd2->Edge(num2);
|
Standard_Real a, b;
|
||||||
Standard_Real a,b;
|
Handle (Geom2d_Curve) c2d;
|
||||||
Handle(Geom2d_Curve) c2d;
|
sae.PCurve (tmpE, face, c2d, a, b, Standard_False);
|
||||||
sae.PCurve(tmpE,face,c2d,a,b,Standard_False);
|
if ((a - p22)*(b - p22) > 0)
|
||||||
if( (a-p22)*(b-p22)>0 ) { // p22 - external for [a,b] => split next edge
|
{ // p22 - external for [a,b] => split next edge
|
||||||
if(SplitEdge1(sewd2, face, num2+1, p22, NewV2, tolV2, boxes2) ) {
|
num2split2++;
|
||||||
NbModif++;
|
|
||||||
numseg2=num2+1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (SplitEdge1 (sewd2, face, num2split2, p22, NewV2, tolV2, boxes2))
|
||||||
if(SplitEdge1(sewd2, face, num2, p22, NewV2, tolV2, boxes2) ) {
|
{
|
||||||
NbModif++;
|
NbModif++;
|
||||||
numseg2=num2+1;
|
numseg2 = num2 + 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpE = sewd2->Edge(numseg2);
|
tmpE = sewd2->Edge(numseg2);
|
||||||
|
7
tests/bugs/heal/bug29695
Normal file
7
tests/bugs/heal/bug29695
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
restore [locate_data_file bug29695_badface.brep] a
|
||||||
|
fixshape result a
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user