1 // Created on: 2021-04-19
2 // Created by: Maria KRYLOVA
3 // Copyright (c) 2021 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Select3D_SensitiveCylinder_HeaderFile
17 #define _Select3D_SensitiveCylinder_HeaderFile
19 #include <Select3D_SensitiveEntity.hxx>
21 //! A framework to define selection by a sensitive cylinder or cone.
22 class Select3D_SensitiveCylinder : public Select3D_SensitiveEntity
24 DEFINE_STANDARD_RTTIEXT (Select3D_SensitiveCylinder, Select3D_SensitiveEntity)
27 //! Constructs a sensitive cylinder object defined by the owner theOwnerId,
28 //! @param[in] theBottomRad cylinder bottom radius
29 //! @param[in] theTopRad cylinder top radius
30 //! @param[in] theHeight cylinder height
31 Standard_EXPORT Select3D_SensitiveCylinder (const Handle(SelectMgr_EntityOwner)& theOwnerId,
32 const Standard_Real theBottomRad,
33 const Standard_Real theTopRad,
34 const Standard_Real theHeight,
35 const gp_Trsf& theTrsf,
36 const Standard_Boolean theIsHollow = Standard_False);
38 //! Checks whether the cylinder overlaps current selecting volume
39 Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
40 SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
42 //! Returns the copy of this
43 Standard_EXPORT virtual Handle (Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
45 //! Returns bounding box of the cylinder.
46 //! If location transformation is set, it will be applied
47 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
49 //! Always returns Standard_False
50 virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
52 //! Returns the amount of points
53 virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 1; }
55 //! Returns center of the cylinder with transformation applied
56 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
58 //! Returns cylinder transformation
59 const gp_Trsf& Transformation() const { return myTrsf; }
61 //! Returns cylinder top radius
62 Standard_Real TopRadius() const { return myTopRadius; }
64 //! Returns cylinder bottom radius
65 Standard_Real BottomRadius() const { return myBottomRadius; }
67 //! Returns cylinder height
68 Standard_Real Height() const { return myHeight; }
70 //! Returns true if the cylinder is empty inside
71 Standard_Boolean IsHollow() const { return myIsHollow; }
74 gp_Trsf myTrsf; //!< cylinder transformation to apply
75 Standard_Real myBottomRadius; //!< cylinder bottom radius
76 Standard_Real myTopRadius; //!< cylinder top radius
77 Standard_Real myHeight; //!< cylinder height
78 Standard_Boolean myIsHollow; //!< true if the cylinder is empty inside
81 #endif // _Select3D_SensitiveSphere_HeaderFile