]> OCCT Git - occt.git/commitdiff
# Add test for cone
authormzernova <mzernova@opencascade.com>
Wed, 31 Jul 2024 12:51:43 +0000 (13:51 +0100)
committermzernova <mzernova@opencascade.com>
Fri, 6 Sep 2024 10:50:34 +0000 (11:50 +0100)
src/StdSelect/StdSelect_BRepSelectionTool.cxx
tests/v3d/bugs/bug33664 [deleted file]
tests/v3d/bugs/bug33664_1 [new file with mode: 0644]
tests/v3d/bugs/bug33664_2 [new file with mode: 0644]

index 5b72c7507d94f06c307bf4c07d2c5f426c5c1e74..bcf81e6917b9451dab78782824733dcdfda16ba4 100644 (file)
@@ -637,8 +637,6 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
         const gp_Cone aCone = BRepAdaptor_Surface (theFace).Cone();
 
         gp_Trsf aTrsf;
-        aTrsf.SetTransformation (aCone.Position(), gp::XOY());
-
         Standard_Real aRad1;
         Standard_Real aRad2;
         Standard_Real aHeight;
@@ -647,14 +645,18 @@ Standard_Boolean StdSelect_BRepSelectionTool::GetSensitiveForFace (const TopoDS_
           aRad1 = 0.0;
           aRad2 = aCircles.First().Radius();
           aHeight = aRad2 * Tan (aCone.SemiAngle());
+          aTrsf.SetTransformation (aCone.Position(), gp::XOY());
         }
         else
         {
-          aRad1 = aCone.RefRadius();
-          aRad2 = IsEqual (aRad1, aCircles.First().Radius()) 
-            ? aCircles.Last().Radius()
-            : aCircles.First().Radius();
+          aRad1 = aCircles.First().Radius();
+          aRad2 = aCircles.Last().Radius();
           aHeight = aCircles.First().Location().Distance (aCircles.Last().Location());
+
+          const gp_Pnt aPos = aCircles.First().Location();
+          const gp_Dir aDirection (aCircles.Last().Location().XYZ() - aPos.XYZ());
+
+          aTrsf.SetTransformation (gp_Ax3(aPos, aDirection), gp::XOY());
         }
 
         Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad1, aRad2, aHeight, aTrsf, true);
diff --git a/tests/v3d/bugs/bug33664 b/tests/v3d/bugs/bug33664
deleted file mode 100644 (file)
index 969ff42..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-puts "============"
-puts "0033664: Visualization - Selection does not work for simple shape"
-puts "============"
-puts ""
-
-pload MODELING VISUALIZATION
-vclear
-vinit View1
-
-restore [locate_data_file cylinder_surface.brep] b
-vdisplay -dispMode 1 b
-vfit
-vsensdis
-
-vselect 200 200
-if {[vnbselected] != "1"} {
-  puts "ERROR: wrong sensitive area"
-}
-
-vselect 0 0
-vdump $::imagedir/${::casename}.png
diff --git a/tests/v3d/bugs/bug33664_1 b/tests/v3d/bugs/bug33664_1
new file mode 100644 (file)
index 0000000..445cc69
--- /dev/null
@@ -0,0 +1,21 @@
+puts "============"
+puts "0033664: Visualization - Selection does not work for simple shape"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+vclear
+vinit View1
+
+restore [locate_data_file cylinder_surface.brep] b
+vdisplay -dispMode 1 b
+vfit
+vsensdis
+
+vselect 200 200
+if {[vnbselected] != "1"} {
+  puts "ERROR: wrong sensitive area"
+}
+
+vselect 0 0
+vdump $::imagedir/${::casename}_cylinder.png
diff --git a/tests/v3d/bugs/bug33664_2 b/tests/v3d/bugs/bug33664_2
new file mode 100644 (file)
index 0000000..ed1cbf6
--- /dev/null
@@ -0,0 +1,36 @@
+puts "============"
+puts "0033664: Visualization - Selection does not work for simple shape"
+puts "============"
+puts ""
+
+pload MODELING VISUALIZATION
+vclear
+vinit View1
+
+pcone c1 50 100 100
+ttranslate c1 100 0 100
+explode c1
+explode c1_1
+
+pcone c2 100 50 100
+ttranslate c2 -100 0 100
+explode c2
+explode c2_1
+
+pcone c3 0 100 100
+ttranslate c3 100 0 -100
+explode c3
+explode c3_1
+
+pcone c4 100 0 100
+ttranslate c4 -100 0 -100
+explode c4
+explode c4_1
+
+vdisplay c1_1_1 c2_1_1 c3_1_1 c4_1_1 -dispmode 1
+vsensdis
+
+vfront
+vfit
+
+vdump $::imagedir/${::casename}_cone.png