From: mzernova Date: Wed, 31 Jul 2024 12:51:43 +0000 (+0100) Subject: # Add test for cone X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=cacbe65d83a7f8ce63ec5aa4f0c8af2a116facc5;p=occt.git # Add test for cone --- diff --git a/src/StdSelect/StdSelect_BRepSelectionTool.cxx b/src/StdSelect/StdSelect_BRepSelectionTool.cxx index 5b72c7507d..bcf81e6917 100644 --- a/src/StdSelect/StdSelect_BRepSelectionTool.cxx +++ b/src/StdSelect/StdSelect_BRepSelectionTool.cxx @@ -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 index 969ff42131..0000000000 --- a/tests/v3d/bugs/bug33664 +++ /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 index 0000000000..445cc692f7 --- /dev/null +++ b/tests/v3d/bugs/bug33664_1 @@ -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 index 0000000000..ed1cbf622a --- /dev/null +++ b/tests/v3d/bugs/bug33664_2 @@ -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