File indexing completed on 2025-01-18 10:04:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _Select3D_SensitiveTriangulation_Header
0018 #define _Select3D_SensitiveTriangulation_Header
0019
0020 #include <TColStd_HArray1OfInteger.hxx>
0021 #include <Select3D_SensitiveSet.hxx>
0022
0023 class Poly_Triangle;
0024 class Poly_Triangulation;
0025
0026
0027 class Select3D_SensitiveTriangulation : public Select3D_SensitiveSet
0028 {
0029 DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangulation, Select3D_SensitiveSet)
0030 public:
0031
0032
0033
0034
0035 Standard_EXPORT Select3D_SensitiveTriangulation (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0036 const Handle(Poly_Triangulation)& theTrg,
0037 const TopLoc_Location& theInitLoc,
0038 const Standard_Boolean theIsInterior = Standard_True);
0039
0040
0041
0042
0043
0044
0045
0046 Standard_EXPORT Select3D_SensitiveTriangulation (const Handle(SelectMgr_EntityOwner)& theOwnerId,
0047 const Handle(Poly_Triangulation)& theTrg,
0048 const TopLoc_Location& theInitLoc,
0049 const Handle(TColStd_HArray1OfInteger)& theFreeEdges,
0050 const gp_Pnt& theCOG,
0051 const Standard_Boolean theIsInterior);
0052 public:
0053
0054
0055
0056
0057 Standard_EXPORT bool LastDetectedTriangle (Poly_Triangle& theTriangle) const;
0058
0059
0060
0061
0062
0063 Standard_EXPORT bool LastDetectedTriangle (Poly_Triangle& theTriangle,
0064 gp_Pnt theTriNodes[3]) const;
0065
0066
0067 Standard_Integer LastDetectedTriangleIndex() const
0068 {
0069 return (myDetectedIdx != -1 && mySensType == Select3D_TOS_INTERIOR && !myBVHPrimIndexes.IsNull())
0070 ? myBVHPrimIndexes->Value (myDetectedIdx) + 1
0071 : -1;
0072 }
0073
0074 public:
0075
0076
0077 Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE;
0078
0079 Standard_EXPORT Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE;
0080
0081 const Handle(Poly_Triangulation)& Triangulation() const { return myTriangul; }
0082
0083
0084 Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
0085
0086
0087 Standard_EXPORT virtual Select3D_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
0088
0089
0090
0091 Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
0092 const Standard_Integer theAxis) const Standard_OVERRIDE;
0093
0094
0095 Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
0096 const Standard_Integer theIdx2) Standard_OVERRIDE;
0097
0098
0099
0100 Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
0101
0102
0103
0104 Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
0105
0106
0107 Standard_EXPORT virtual Standard_Boolean HasInitLocation() const Standard_OVERRIDE;
0108
0109
0110
0111 Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE;
0112
0113 const TopLoc_Location& GetInitLocation() const { return myInitLocation; }
0114
0115
0116 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0117
0118
0119 Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
0120 SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
0121
0122 protected:
0123
0124
0125 void computeBoundingBox();
0126
0127
0128
0129 Select3D_BndBox3d applyTransformation();
0130
0131 private:
0132
0133
0134 Standard_EXPORT virtual Standard_Boolean overlapsElement (SelectBasics_PickResult& thePickResult,
0135 SelectBasics_SelectingVolumeManager& theMgr,
0136 Standard_Integer theElemIdx,
0137 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
0138
0139
0140 Standard_EXPORT virtual Standard_Real distanceToCOG (SelectBasics_SelectingVolumeManager& theMgr) Standard_OVERRIDE;
0141
0142
0143 Standard_EXPORT virtual Standard_Boolean elementIsInside (SelectBasics_SelectingVolumeManager& theMgr,
0144 Standard_Integer theElemIdx,
0145 Standard_Boolean theIsFullInside) Standard_OVERRIDE;
0146
0147 protected:
0148
0149 Handle(Poly_Triangulation) myTriangul;
0150 TopLoc_Location myInitLocation;
0151 gp_Pnt myCDG3D;
0152 Handle(TColStd_HArray1OfInteger) myFreeEdges;
0153 Standard_Boolean mySensType;
0154 Standard_Integer myPrimitivesNb;
0155 Handle(TColStd_HArray1OfInteger) myBVHPrimIndexes;
0156 mutable Select3D_BndBox3d myBndBox;
0157 gp_GTrsf myInvInitLocation;
0158 };
0159
0160 DEFINE_STANDARD_HANDLE(Select3D_SensitiveTriangulation, Select3D_SensitiveSet)
0161
0162 #endif