Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:18:47

0001 // Created on: 1997-05-14
0002 // Created by: Robert COUBLANC
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Select3D_SensitiveTriangle_HeaderFile
0018 #define _Select3D_SensitiveTriangle_HeaderFile
0019 
0020 #include <Select3D_TypeOfSensitivity.hxx>
0021 #include <Select3D_SensitivePoly.hxx>
0022 #include <SelectMgr_SelectingVolumeManager.hxx>
0023 
0024 //! A framework to define selection of triangles in a view.
0025 //! This comes into play in the detection of meshing and triangulation in surfaces.
0026 //! In some cases this class can raise Standard_ConstructionError and
0027 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
0028 class Select3D_SensitiveTriangle : public Select3D_SensitiveEntity
0029 {
0030 public:
0031   //! Constructs a sensitive triangle object defined by the
0032   //! owner theOwnerId, the points P1, P2, P3, and the type of sensitivity Sensitivity.
0033   Standard_EXPORT Select3D_SensitiveTriangle(
0034     const occ::handle<SelectMgr_EntityOwner>& theOwnerId,
0035     const gp_Pnt&                             thePnt0,
0036     const gp_Pnt&                             thePnt1,
0037     const gp_Pnt&                             thePnt2,
0038     const Select3D_TypeOfSensitivity          theType = Select3D_TOS_INTERIOR);
0039 
0040   //! Checks whether the triangle overlaps current selecting volume
0041   Standard_EXPORT bool Matches(SelectBasics_SelectingVolumeManager& theMgr,
0042                                SelectBasics_PickResult&             thePickResult) override;
0043 
0044   //! Returns the 3D points P1, P2, P3 used at the time of construction.
0045   void Points3D(gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const
0046   {
0047     thePnt0 = myPoints[0];
0048     thePnt1 = myPoints[1];
0049     thePnt2 = myPoints[2];
0050   }
0051 
0052   //! Returns the center point of the sensitive triangle created at construction time.
0053   gp_Pnt Center3D() const { return myCentroid; }
0054 
0055   //! Returns the copy of this
0056   Standard_EXPORT occ::handle<Select3D_SensitiveEntity> GetConnected() override;
0057 
0058   //! Returns bounding box of the triangle. If location transformation is set, it
0059   //! will be applied
0060   Standard_EXPORT Select3D_BndBox3d BoundingBox() override;
0061 
0062   //! Returns TRUE if BVH tree is in invalidated state
0063   bool ToBuildBVH() const override { return false; }
0064 
0065   //! Returns the amount of points
0066   int NbSubElements() const override { return 3; }
0067 
0068   gp_Pnt CenterOfGeometry() const override { return myCentroid; }
0069 
0070   //! Dumps the content of me into the stream
0071   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0072 
0073   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangle, Select3D_SensitiveEntity)
0074 
0075 private:
0076   Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: boundary or interior
0077   gp_Pnt                     myCentroid; //!< Center of triangle
0078   gp_Pnt                     myPoints[3];
0079 };
0080 
0081 #endif