1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0033084: Visualization - Cylindrical prism is selectable only by its base when extruded in some directions

Fixed bounding boxes for Select3D_SensitiveCylinder.

Added display of Select3D_SensitiveCylinder presentation using the "vsensdis" command.
Added test vselect/bugs/bug33084.
This commit is contained in:
mzernova
2022-08-03 12:46:53 +03:00
committed by smoskvin
parent 6072d3093c
commit 81d569625e
5 changed files with 100 additions and 14 deletions

View File

@@ -81,17 +81,14 @@ Handle(Select3D_SensitiveEntity) Select3D_SensitiveCylinder::GetConnected()
Select3D_BndBox3d Select3D_SensitiveCylinder::BoundingBox()
{
Standard_Real aMaxRad = Max (myBottomRadius, myTopRadius);
gp_Pnt aCenterBottom (0, 0, 0);
gp_Pnt aCenterTop (0, 0, myHeight);
aCenterBottom.Transform (myTrsf);
aCenterTop.Transform (myTrsf);
const SelectMgr_Vec3 aMinPnt (Min (aCenterBottom.X(), aCenterTop.X()) - aMaxRad,
Min (aCenterBottom.Y(), aCenterTop.Y()) - aMaxRad,
Min (aCenterBottom.Z(), aCenterTop.Z()) - aMaxRad);
const SelectMgr_Vec3 aMaxPnt (Max (aCenterBottom.X(), aCenterTop.X()) + aMaxRad,
Max (aCenterBottom.Y(), aCenterTop.Y()) + aMaxRad,
Max (aCenterBottom.Z(), aCenterTop.Z()) + aMaxRad);
return Select3D_BndBox3d (aMinPnt, aMaxPnt);
Graphic3d_Mat4d aTrsf;
myTrsf.GetMat4 (aTrsf);
Select3D_BndBox3d aBox (SelectMgr_Vec3 (-aMaxRad, -aMaxRad, 0),
SelectMgr_Vec3 (aMaxRad, aMaxRad, myHeight));
aBox.Transform (aTrsf);
return aBox;
}
//==================================================

View File

@@ -54,6 +54,18 @@ public:
//! Returns center of the cylinder with transformation applied
Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
//! Returns cylinder transformation
const gp_Trsf& Transformation() const { return myTrsf; }
//! Returns cylinder top radius
Standard_Real TopRadius() const { return myTopRadius; }
//! Returns cylinder bottom radius
Standard_Real BottomRadius() const { return myBottomRadius; }
//! Returns cylinder height
Standard_Real Height() const { return myHeight; }
protected:
gp_Trsf myTrsf; //!< cylinder transformation to apply
Standard_Real myBottomRadius; //!< cylinder bottom radius