0027008: Visualization - polygonal selection algorithm does not work with MeshVS_Mesh
authorvpa <vpa@opencascade.com>
Fri, 28 Oct 2016 12:03:38 +0000 (15:03 +0300)
committerapn <apn@opencascade.com>
Thu, 3 Nov 2016 11:15:53 +0000 (14:15 +0300)
- correct calculation of normals for SelectMgr_TriangularFrustum;
- test case for issue #27008

src/SelectMgr/SelectMgr_TriangularFrustum.cxx
tests/bugs/vis/bug27008 [new file with mode: 0644]

index 641e754..9a0bc83 100644 (file)
@@ -27,13 +27,13 @@ namespace
   void computeFrustumNormals (const gp_Vec* theEdges, gp_Vec* theNormals)
   {
     // V0V1
-    theNormals[0] = theEdges[0].Crossed (theEdges[1]);
+    theNormals[0] = theEdges[0].Crossed (theEdges[3]);
     // V1V2
-    theNormals[1] = theEdges[1].Crossed (theEdges[2]);
+    theNormals[1] = theEdges[1].Crossed (theEdges[4]);
     // V0V2
-    theNormals[2] = theEdges[0].Crossed (theEdges[2]);
+    theNormals[2] = theEdges[0].Crossed (theEdges[5]);
     // Near
-    theNormals[3] = theEdges[3].Crossed (theEdges[5]);
+    theNormals[3] = theEdges[3].Crossed (theEdges[4]);
     // Far
     theNormals[4] = -theNormals[3];
   }
diff --git a/tests/bugs/vis/bug27008 b/tests/bugs/vis/bug27008
new file mode 100644 (file)
index 0000000..24a6bfd
--- /dev/null
@@ -0,0 +1,27 @@
+puts "==========="
+puts "OCC27008"
+puts "==========="
+puts ""
+##########################################################################
+# Visualization - polygonal selection algorithm does not work with MeshVS_Mesh
+##########################################################################
+
+pload VISUALIZATION XDE
+
+vclear
+vinit View1
+meshfromstl m [locate_data_file head.stl]
+vsetdispmode m 2
+
+vselmode m 8 1
+vselect 0 0 409 409 0 409
+if { [vnbselected] != "56748" } { puts "Error: the number of selected elements differs for mode 8" }
+vdump $imagedir/${casename}_mode_8.png
+
+vselect 0 0
+
+vselmode m 8 0
+vselmode m 1 1
+vselect 0 0 409 409 0 409
+if { [vnbselected] != "30830" } { puts "Error: the number of selected elements differs for mode 1" }
+vdump $imagedir/${casename}_mode_1.png