]> OCCT Git - occt.git/commitdiff
0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV
authorifv <ifv@opencascade.com>
Sat, 12 Nov 2022 17:45:36 +0000 (20:45 +0300)
committerVadim Glukhikh <vadim.glukhikh@opencascade.com>
Mon, 21 Nov 2022 17:10:06 +0000 (20:10 +0300)
ShapeUpgrade_UnifySameDomain.cxx - method ReconstructMissedSeam is improved.

tests/bugs/heal/bug33193 - new test case added

src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
tests/bugs/heal/bug33193 [new file with mode: 0644]

index fdda539d6c0454ce64b77072d76fd07bd46747cf..7d603b2dae6b84d2c0769aaae4c79746ddf2b85f 100644 (file)
@@ -753,7 +753,25 @@ static void ReconstructMissedSeam(const TopTools_SequenceOfShape& theRemovedEdge
       if ((theUperiod != 0. && aUdiff > theUperiod/2) ||
           (theVperiod != 0. && aVdiff > theVperiod/2))
       {
-        anEdge.Reverse();
+        if (aLastVertex.IsSame(theCurVertex) || (theUperiod != 0. && theVperiod != 0.))
+        {
+          anEdge.Reverse();
+        }
+        else
+        {
+          TopAbs_Orientation anOri = anEdge.Orientation();
+          anEdge.Orientation(TopAbs_FORWARD);
+          Handle(Geom2d_Curve) aPC1 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
+          anEdge.Reverse();
+          Handle(Geom2d_Curve) aPC2 = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
+          anEdge.Reverse(); // again FORWARD
+          TopLoc_Location aLoc;
+          BRep_Builder aBB;
+          Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
+          const  Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(theFrefFace, aLoc);
+          aBB.UpdateEdge(anEdge, aPC2, aPC1, aSurf, aLoc, aTol);
+          anEdge.Orientation(anOri);
+        }
         aPC = BRep_Tool::CurveOnSurface(anEdge, theFrefFace, Param1, Param2);
         aParam = (anEdge.Orientation() == TopAbs_FORWARD)? Param1 : Param2;
         aPoint = aPC->Value(aParam);
diff --git a/tests/bugs/heal/bug33193 b/tests/bugs/heal/bug33193
new file mode 100644 (file)
index 0000000..5726245
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========================================="
+puts "0033193: Modeling Algorithms - Regression: UnifySameDomain raises SIGSEGV"
+puts "========================================="
+puts ""
+
+restore [locate_data_file bug33193.brep] a
+
+unifysamedom result a
+
+checkshape result
+
+checknbshapes result -t -solid 1 -shell 1 -face 152 -wire 202 -edge 411 -vertex 273
+
+set tolres [checkmaxtol result]
+
+if { ${tolres} > 1.26e-7} {
+   puts "Error: bad tolerance of result"
+}
+