Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:52

0001 // Created on: 2021-04-19
0002 // Created by: Maria KRYLOVA
0003 // Copyright (c) 2021 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Select3D_SensitiveCylinder_HeaderFile
0017 #define _Select3D_SensitiveCylinder_HeaderFile
0018 
0019 #include <Select3D_SensitiveEntity.hxx>
0020 
0021 //! A framework to define selection by a sensitive cylinder or cone.
0022 class Select3D_SensitiveCylinder : public Select3D_SensitiveEntity
0023 {
0024   DEFINE_STANDARD_RTTIEXT (Select3D_SensitiveCylinder, Select3D_SensitiveEntity)
0025 
0026 public:
0027   //! Constructs a sensitive cylinder object defined by the owner theOwnerId,
0028   //! @param[in] theBottomRad cylinder bottom radius
0029   //! @param[in] theTopRad    cylinder top radius
0030   //! @param[in] theHeight    cylinder height
0031   Standard_EXPORT Select3D_SensitiveCylinder (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0032                                               const Standard_Real theBottomRad,
0033                                               const Standard_Real theTopRad,
0034                                               const Standard_Real theHeight,
0035                                               const gp_Trsf& theTrsf,
0036                                               const Standard_Boolean theIsHollow = Standard_False);
0037 
0038   //! Checks whether the cylinder overlaps current selecting volume
0039   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
0040                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
0041 
0042   //! Returns the copy of this
0043   Standard_EXPORT virtual Handle (Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0044 
0045   //! Returns bounding box of the cylinder.
0046   //! If location transformation is set, it will be applied
0047   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0048 
0049   //! Always returns Standard_False
0050   virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
0051 
0052   //! Returns the amount of points
0053   virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 1; }
0054 
0055   //! Returns center of the cylinder with transformation applied
0056   Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
0057 
0058   //! Returns cylinder transformation
0059   const gp_Trsf& Transformation() const { return myTrsf; }
0060 
0061   //! Returns cylinder top radius
0062   Standard_Real TopRadius() const { return myTopRadius; }
0063 
0064   //! Returns cylinder bottom radius
0065   Standard_Real BottomRadius() const { return myBottomRadius; }
0066 
0067   //! Returns cylinder height
0068   Standard_Real Height() const { return myHeight; }
0069 
0070   //! Returns true if the cylinder is empty inside
0071   Standard_Boolean IsHollow() const { return myIsHollow; }
0072 
0073 protected:
0074   gp_Trsf          myTrsf;         //!< cylinder transformation to apply
0075   Standard_Real    myBottomRadius; //!< cylinder bottom radius
0076   Standard_Real    myTopRadius;    //!< cylinder top radius
0077   Standard_Real    myHeight;       //!< cylinder height
0078   Standard_Boolean myIsHollow;     //!< true if the cylinder is empty inside
0079 };
0080 
0081 #endif // _Select3D_SensitiveSphere_HeaderFile