Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:10

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 occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0032                                              const double                              theBottomRad,
0033                                              const double                              theTopRad,
0034                                              const double                              theHeight,
0035                                              const gp_Trsf&                            theTrsf,
0036                                              const bool theIsHollow = false);
0037 
0038   //! Checks whether the cylinder overlaps current selecting volume
0039   Standard_EXPORT bool Matches(SelectBasics_SelectingVolumeManager& theMgr,
0040                                SelectBasics_PickResult&             thePickResult) override;
0041 
0042   //! Returns the copy of this
0043   Standard_EXPORT occ::handle<Select3D_SensitiveEntity> GetConnected() override;
0044 
0045   //! Returns bounding box of the cylinder.
0046   //! If location transformation is set, it will be applied
0047   Standard_EXPORT Select3D_BndBox3d BoundingBox() override;
0048 
0049   //! Always returns false
0050   bool ToBuildBVH() const override { return false; }
0051 
0052   //! Returns the amount of points
0053   int NbSubElements() const override { return 1; }
0054 
0055   //! Returns center of the cylinder with transformation applied
0056   Standard_EXPORT gp_Pnt CenterOfGeometry() const override;
0057 
0058   //! Returns cylinder transformation
0059   const gp_Trsf& Transformation() const { return myTrsf; }
0060 
0061   //! Returns cylinder top radius
0062   double TopRadius() const { return myTopRadius; }
0063 
0064   //! Returns cylinder bottom radius
0065   double BottomRadius() const { return myBottomRadius; }
0066 
0067   //! Returns cylinder height
0068   double Height() const { return myHeight; }
0069 
0070   //! Returns true if the cylinder is empty inside
0071   bool IsHollow() const { return myIsHollow; }
0072 
0073 protected:
0074   gp_Trsf myTrsf;         //!< cylinder transformation to apply
0075   double  myBottomRadius; //!< cylinder bottom radius
0076   double  myTopRadius;    //!< cylinder top radius
0077   double  myHeight;       //!< cylinder height
0078   bool    myIsHollow;     //!< true if the cylinder is empty inside
0079 };
0080 
0081 #endif // _Select3D_SensitiveSphere_HeaderFile