]> OCCT Git - occt.git/commitdiff
0023860: Bad memory access intersecting two nearly coincident cylindrical faces CR23860
authorvmigunov <viktor.migunov@opencascade.com>
Fri, 12 Aug 2022 09:29:03 +0000 (12:29 +0300)
committervmigunov <viktor.migunov@opencascade.com>
Fri, 12 Aug 2022 09:29:03 +0000 (12:29 +0300)
Test of 2 nearly coincident cylindrical faces intersection is added

src/BOPTest/BOPTest_BOPCommands.cxx
tests/bugs/modalg_8/bug23860 [new file with mode: 0644]

index f22b0c2a3fab876e7ba1adc81302a3932136edd3..379adca0d59400edf5993b89af8bb81c8070bebf 100644 (file)
@@ -103,7 +103,7 @@ static Standard_Integer mkvolume   (Draw_Interpretor&, Standard_Integer, const c
                                "-na - disables the approximation of the section curves.\n",
                                                       __FILE__, bsection, g);
   //
-  theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2] "
+  theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d/-2d1/-2d2] [-noapprox] "
                                "[-p u1 v1 u2 v2 (to add start points] [-v (for extended output)]",
                                                       __FILE__, bopcurves, g);
   theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni] [-ai]",
@@ -544,7 +544,7 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
                             const char** a)
 {
   if (n<3) {
-    di << "Usage: bopcurves F1 F2 [-2d/-2d1/-2d2] "
+    di << "Usage: bopcurves F1 F2 [-2d/-2d1/-2d2] [-noapprox] "
           "[-p u1 v1 u2 v2 (to add start points] [-v (for extended output)]\n";
     return 1;
   }
@@ -597,6 +597,9 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
     else if (!strcasecmp(a[i],"-2d2")) {
       aToApproxC2dOnS2 = Standard_True;
     }
+    else if (!strcasecmp(a[i],"-noapprox")) {
+      aToApproxC3d     = Standard_False;
+    }
     else if (!strcasecmp(a[i],"-p")) {
       IntSurf_PntOn2S aPt;
       const Standard_Real aU1 = Draw::Atof(a[++i]);
diff --git a/tests/bugs/modalg_8/bug23860 b/tests/bugs/modalg_8/bug23860
new file mode 100644 (file)
index 0000000..34b434d
--- /dev/null
@@ -0,0 +1,39 @@
+puts "================================================="
+puts "0023860: Bad memory access intersecting two nearly coincident cylindrical faces"
+puts "================================================="
+puts ""
+
+cylinder c1 1031.3339148728076 -113.25868616662650 56.152387686082520 \
+            -0.86602540378443815 0.50000000000000089 0.00000000000000000 \
+            -0.50000000000000089 -0.86602540378443815 0.00000000000000000 \
+            76.499999999999986
+cylinder c2 1017.0706583606553 -103.24955863669388 56.152387686082548 \
+            0.86602540378443915 -0.49999999999999933 0.00000000000000000 \
+            0.49999999999999933 0.86602540378443915 0.00000000000000000 \
+            76.499999999999986
+mkface f1 c1 
+mkface f2 c2
+
+set curves_found [lindex [split [bopcurves f1 f2 -2d -noapprox] "\n"] 1]
+if { $curves_found != "2 curve(s) found." } {
+  puts "Error wrong curves number"
+}
+
+smallview
+donly c_1 c_2
+fit
+xwd ${imagedir}/${casename}_1.png
+
+set lines [split [dump c_1] "\n"]
+
+if { [lindex $lines 4] != "  Origin :1031.71804748645, -112.593348962955, -20.34375449469 " ||
+     [lindex $lines 5] != "  Axis   :-0.866025403784438, 0.500000000000001, 0 " } {
+  puts "Error: wrong first curve"
+}
+
+set lines [split [dump c_2] "\n"]
+
+if { [lindex $lines 4] != "  Origin :1031.71804748645, -112.593348962957, 132.648529866855 " ||
+     [lindex $lines 5] != "  Axis   :-0.866025403784438, 0.500000000000001, 0 "} {
+  puts "Error: wrong second curve"
+}