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_1 similarity index 88% rename from tests/v3d/bugs/bug33664 rename to tests/v3d/bugs/bug33664_1 index 969ff42131..445cc692f7 100644 --- a/tests/v3d/bugs/bug33664 +++ b/tests/v3d/bugs/bug33664_1 @@ -18,4 +18,4 @@ if {[vnbselected] != "1"} { } vselect 0 0 -vdump $::imagedir/${::casename}.png +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