From: gka Date: Fri, 31 Jan 2020 13:24:38 +0000 (+0300) Subject: 0031233: ACIS Import - Reading SAT files produces invalid shapes X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR0_CI_740-GKA;p=occt-copy.git 0031233: ACIS Import - Reading SAT files produces invalid shapes Modification to avoid splitting edge fir case whewn split point lies inside tolerance of edge vertices --- diff --git a/src/ShapeFix/ShapeFix_ComposeShell.cxx b/src/ShapeFix/ShapeFix_ComposeShell.cxx index 2444f685bb..d3bdbac8a6 100644 --- a/src/ShapeFix/ShapeFix_ComposeShell.cxx +++ b/src/ShapeFix/ShapeFix_ComposeShell.cxx @@ -983,15 +983,16 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir else { currPnt2d = C2d->Value(currPar); currPnt = myGrid->Value ( currPnt2d ); - if ( currPnt.Distance ( lastVPnt ) <= lastVTol && - lastPnt.Distance ( currPnt ) <= tol && + if ( (currPnt.Distance ( lastVPnt ) <= lastVTol || + lastPnt.Distance ( currPnt ) <= tol ) && // Tolerance is increased to prevent degenerated cuts in cases where all vertex // tolerance is covered by distance of the edge curve from vertex point. // Doubled to prevent edge being fully covered by its vertices tolerance (invalid edge). - CheckByCurve3d ( lastVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d, - T, lastVTol + 2 * Precision::Confusion() ) && - lastPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+lastPar)) ) ) <= tol ) { + (CheckByCurve3d ( lastVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d, + T, lastVTol + 2 * Precision::Confusion() ) || + lastPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+lastPar)) ) ) <= lastVTol )) { V = lastV; + tol = lastVTol; Standard_Real uRes = myUResolution; Standard_Real vRes = myVResolution; if(isCutByU) { @@ -1002,19 +1003,20 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(),cutIndex)/tol; vRes = Min(myVResolution,gridRes); } - if ( IsCoincided ( lastPnt2d, currPnt2d, uRes, vRes, tol ) && - IsCoincided ( lastPnt2d, C2d->Value(0.5*(currPar+lastPar)), uRes, vRes, tol ) ) + /*if ( IsCoincided ( lastPnt2d, currPnt2d, uRes, vRes, tol ) && + IsCoincided ( lastPnt2d, C2d->Value(0.5*(currPar+lastPar)), uRes, vRes, tol ) )*/ doCut = Standard_False; } - else if ( currPnt.Distance ( prevVPnt ) <= prevVTol && - prevPnt.Distance ( currPnt ) <= tol && + else if ( (currPnt.Distance ( prevVPnt ) <= prevVTol || + prevPnt.Distance ( currPnt ) <= tol )&& // Tolerance is increased to prevent degenerated cuts in cases where all vertex // tolerance is covered by distance of the edge curve from vertex point. // Doubled to prevent edge being fully covered by its vertices tolerance (invalid edge). - CheckByCurve3d ( prevVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d, + (CheckByCurve3d ( prevVPnt, c3d, f3d+(currPar-firstPar)*(l3d-f3d)/span2d, T, prevVTol + 2 * Precision::Confusion()) && - prevPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+prevPar)) ) ) <= tol ) { + prevPnt.Distance ( myGrid->Value ( C2d->Value(0.5*(currPar+prevPar)) ) ) <= prevVTol )) { V = prevV; + tol = prevVTol; Standard_Real uRes = myUResolution; Standard_Real vRes = myVResolution; if(isCutByU) { @@ -1025,8 +1027,8 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir Standard_Real gridRes = GetGridResolution(myGrid->VJointValues(),cutIndex)/tol; vRes = Min(myVResolution,gridRes); } - if ( IsCoincided ( prevPnt2d, currPnt2d, uRes, vRes, tol ) && - IsCoincided ( prevPnt2d, C2d->Value(0.5*(currPar+prevPar)), uRes, vRes, tol ) ) { + /*if ( IsCoincided ( prevPnt2d, currPnt2d, uRes, vRes, tol ) && + IsCoincided ( prevPnt2d, C2d->Value(0.5*(currPar+prevPar)), uRes, vRes, tol ) )*/ { vertices.Append ( prevV ); code = SegmentCodes ( j ); // classification code - update for next segment continue; // no splitting at this point, go to next one @@ -1348,8 +1350,11 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire, Standard_Integer i; for ( i = 1; i <= Inter.NbPoints(); i++ ) { IntRes2d_IntersectionPoint IP = Inter.Point (i); - IntLinePar.Append ( IP.ParamOnFirst() ); - IntEdgePar.Append ( IP.ParamOnSecond() ); + if( IP.TransitionOfSecond().PositionOnCurve() == IntRes2d_Middle) + { + IntLinePar.Append ( IP.ParamOnFirst() ); + IntEdgePar.Append ( IP.ParamOnSecond() ); + } } for ( i = 1; i <= Inter.NbSegments(); i++ ) { IntRes2d_IntersectionSegment IS = Inter.Segment (i); diff --git a/tests/bugs/heal/bug22919 b/tests/bugs/heal/bug22919 index ac5add3a65..e4a83dcac8 100644 --- a/tests/bugs/heal/bug22919 +++ b/tests/bugs/heal/bug22919 @@ -1,5 +1,3 @@ -puts "TODO All: Faulty shapes in variables faulty_1 to faulty_" - puts "========" puts "OCC22919" puts "========"