Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:59:11

0001 // Created on: 2014-08-15
0002 // Created by: Varvara POSKONINA
0003 // Copyright (c) 2005-2014 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_InteriorSensitivePointSet_HeaderFile
0017 #define _Select3D_InteriorSensitivePointSet_HeaderFile
0018 
0019 #include <Select3D_SensitivePoly.hxx>
0020 #include <Select3D_SensitiveSet.hxx>
0021 
0022 class SelectMgr_EntityOwner;
0023 
0024 //! This class handles the selection of arbitrary point set with internal type of sensitivity.
0025 //! The main principle is to split the point set given onto planar convex polygons and search
0026 //! for the overlap with one or more of them through traverse of BVH tree.
0027 class Select3D_InteriorSensitivePointSet : public Select3D_SensitiveSet
0028 {
0029 public:
0030   //! Splits the given point set thePoints onto planar convex polygons
0031   Standard_EXPORT Select3D_InteriorSensitivePointSet(
0032     const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0033     const NCollection_Array1<gp_Pnt>&         thePoints);
0034 
0035   //! Returns 3d coordinates of vertices of the whole point set.
0036   //! @return handle to array of 3D vertex coordinates
0037   [[nodiscard]] Standard_EXPORT occ::handle<NCollection_HArray1<gp_Pnt>> GetPoints() const;
0038 
0039   //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the
0040   //! whole point set
0041   //! @deprecated Use GetPoints() returning handle by value instead.
0042   Standard_DEPRECATED("Use GetPoints() returning handle by value instead")
0043   Standard_EXPORT virtual void GetPoints(occ::handle<NCollection_HArray1<gp_Pnt>>& theHArrayOfPnt);
0044 
0045   //! Returns the length of vector of planar convex polygons
0046   Standard_EXPORT int Size() const override;
0047 
0048   //! Returns bounding box of planar convex polygon with index theIdx
0049   Standard_EXPORT Select3D_BndBox3d Box(const int theIdx) const override;
0050 
0051   //! Returns geometry center of planar convex polygon with index
0052   //! theIdx in the vector along the given axis theAxis
0053   Standard_EXPORT double Center(const int theIdx, const int theAxis) const override;
0054 
0055   //! Swaps items with indexes theIdx1 and theIdx2 in the vector
0056   Standard_EXPORT void Swap(const int theIdx1, const int theIdx2) override;
0057 
0058   //! Returns bounding box of the point set. If location
0059   //! transformation is set, it will be applied
0060   Standard_EXPORT Select3D_BndBox3d BoundingBox() override;
0061 
0062   //! Returns center of the point set. If location
0063   //! transformation is set, it will be applied
0064   Standard_EXPORT gp_Pnt CenterOfGeometry() const override;
0065 
0066   //! Returns the amount of points in set
0067   Standard_EXPORT int NbSubElements() const override;
0068 
0069   //! Dumps the content of me into the stream
0070   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0071 
0072   DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet, Select3D_SensitiveSet)
0073 
0074 protected:
0075   //! Checks whether the planar convex polygon with index theIdx
0076   //! in myPlanarPolygons overlaps the current selecting volume
0077   Standard_EXPORT bool overlapsElement(SelectBasics_PickResult&             thePickResult,
0078                                        SelectBasics_SelectingVolumeManager& theMgr,
0079                                        int                                  theElemIdx,
0080                                        bool theIsFullInside) override;
0081 
0082   //! Checks whether the entity with index theIdx is inside the current selecting volume
0083   Standard_EXPORT bool elementIsInside(SelectBasics_SelectingVolumeManager& theMgr,
0084                                        int                                  theElemIdx,
0085                                        bool theIsFullInside) override;
0086 
0087   //! Calculates distance from the 3d projection of used-picked
0088   //! screen point to center of the geometry
0089   Standard_EXPORT double distanceToCOG(SelectBasics_SelectingVolumeManager& theMgr) override;
0090 
0091 protected:
0092   NCollection_DynamicArray<occ::handle<Select3D_SensitivePoly>>
0093                                         myPlanarPolygons; //!< Vector of planar polygons
0094   occ::handle<NCollection_HArray1<int>> myPolygonsIdxs;   //!< Indexes array for BVH calculation
0095   gp_Pnt                                myCOG;            //!< Center of the point set
0096   Select3D_BndBox3d                     myBndBox;         //!< Bounding box of the point set
0097 };
0098 
0099 #endif // _Select3D_InteriorSensitivePointSet_HeaderFile