Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0025 //! A framework to define selection of triangles in a view.
0026 //! This comes into play in the detection of meshing and triangulation in surfaces.
0027 //! In some cases this class can raise Standard_ConstructionError and
0028 //! Standard_OutOfRange exceptions. For more details see Select3D_SensitivePoly.
0029 class Select3D_SensitiveTriangle : public Select3D_SensitiveEntity
0030 {
0031 public:
0032 
0033   //! Constructs a sensitive triangle object defined by the
0034   //! owner theOwnerId, the points P1, P2, P3, and the type of sensitivity Sensitivity.
0035   Standard_EXPORT Select3D_SensitiveTriangle (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0036                                               const gp_Pnt& thePnt0,
0037                                               const gp_Pnt& thePnt1,
0038                                               const gp_Pnt& thePnt2,
0039                                               const Select3D_TypeOfSensitivity theType = Select3D_TOS_INTERIOR);
0040 
0041   //! Checks whether the triangle overlaps current selecting volume
0042   Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
0043                                                     SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
0044 
0045   //! Returns the 3D points P1, P2, P3 used at the time of construction.
0046   void Points3D (gp_Pnt& thePnt0, gp_Pnt& thePnt1, gp_Pnt& thePnt2) const
0047   {
0048     thePnt0 = myPoints[0];
0049     thePnt1 = myPoints[1];
0050     thePnt2 = myPoints[2];
0051   }
0052 
0053   //! Returns the center point of the sensitive triangle created at construction time.
0054   gp_Pnt Center3D() const { return myCentroid; }
0055 
0056   //! Returns the copy of this
0057   Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0058 
0059   //! Returns bounding box of the triangle. If location transformation is set, it
0060   //! will be applied
0061   Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0062 
0063   //! Returns TRUE if BVH tree is in invalidated state
0064   virtual Standard_Boolean ToBuildBVH() const Standard_OVERRIDE { return Standard_False; }
0065 
0066   //! Returns the amount of points
0067   virtual Standard_Integer NbSubElements() const Standard_OVERRIDE { return 3; }
0068 
0069   virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; }
0070 
0071   //! Dumps the content of me into the stream
0072   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0073 
0074   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangle,Select3D_SensitiveEntity)
0075 
0076 private:
0077 
0078   Select3D_TypeOfSensitivity mySensType;     //!< Type of sensitivity: boundary or interior
0079   gp_Pnt                     myCentroid;     //!< Center of triangle
0080   gp_Pnt                     myPoints[3];
0081 };
0082 
0083 DEFINE_STANDARD_HANDLE(Select3D_SensitiveTriangle, Select3D_SensitiveEntity)
0084 
0085 #endif