0024033: All the orientation as a result of BRepAlgoAPI_Common is set to INTERNAL
authoremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:23:22 +0000 (14:23 +0400)
committeremv <emv@opencascade.com>
Thu, 4 Jul 2013 10:23:22 +0000 (14:23 +0400)
Dimension of the shapes is used in the condition of choosing the shape to take parts of it in the common.
Adding test case for this fix

src/BOPAlgo/BOPAlgo_BOP.cxx
tests/bugs/modalg_5/bug24033 [new file with mode: 0755]

index 0ce0829..3def311 100644 (file)
@@ -553,7 +553,11 @@ static
   //
   // 3. Find common parts
   if (myOperation==BOPAlgo_COMMON) {
-    iX=(aNb[0]>aNb[1])? 1 : 0;
+    if (myDims[0]==myDims[1]) {
+      iX=(aNb[0]>aNb[1])? 1 : 0;
+    } else {
+      iX=(myDims[0]<myDims[1]) ? 0 : 1;
+    }
     iY=(iX+1)%2;
   }
   else if (myOperation==BOPAlgo_CUT) {
diff --git a/tests/bugs/modalg_5/bug24033 b/tests/bugs/modalg_5/bug24033
new file mode 100755 (executable)
index 0000000..5d0dbb4
--- /dev/null
@@ -0,0 +1,60 @@
+puts "========"
+puts "CR24033"
+puts "========"
+puts ""
+#########################################
+## All the orientation as a result of BRepAlgoAPI_Common is set to INTERNAL
+#########################################
+
+polyline f1 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0
+mkplane f1 f1
+polyline f2 0 1 0 0 2 0 1 2 0 1 1 0 0 1 0
+mkplane f2 f2
+polyline f3 0 2 0 0 3 0 1 3 0 1 2 0 0 2 0
+mkplane f3 f3
+
+polyline f4 1 0 0 1 1 0 2 1 0 2 0 0 1 0 0
+mkplane f4 f4
+polyline f5 1 1 0 1 2 0 2 2 0 2 1 0 1 1 0
+mkplane f5 f5
+polyline f6 1 2 0 1 3 0 2 3 0 2 2 0 1 2 0
+mkplane f6 f6
+
+polyline f7 2 0 0 2 1 0 3 1 0 3 0 0 2 0 0
+mkplane f7 f7
+polyline f8 2 1 0 2 2 0 3 2 0 3 1 0 2 1 0
+mkplane f8 f8
+polyline f9 2 2 0 2 3 0 3 3 0 3 2 0 2 2 0
+mkplane f9 f9
+
+sewing s f1 f2 f3 f4 f5 f6 f6 f7 f8 f9
+
+box b -1 1 -1 2 1 2
+
+bop s b
+bopcommon r
+explode r
+
+explode r_1
+set info_f [whatis r_1_1]
+if { [regexp {INTERNAL} ${info_f}] } {
+    puts "Faulty : Wrong orientation of the face"
+} else {
+    puts "Correct orientation of the face"
+}
+
+explode r_1_1 e
+set info_e [whatis r_1_1_1]
+if { [regexp {INTERNAL} ${info_e}] } {
+    puts "Faulty : Wrong orientation of the edge"
+} else {
+    puts "Correct orientation of the edge"
+}
+
+explode r_1_1 v
+set info_v [whatis r_1_1_1]
+if { [regexp {INTERNAL} ${info_v}] } {
+    puts "Faulty : Wrong orientation of the vertex"
+} else {
+    puts "Correct orientation of the vertex"
+}