File indexing completed on 2026-09-14 09:15:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _SelectMgr_TriangularFrustumSet_HeaderFile
0017 #define _SelectMgr_TriangularFrustumSet_HeaderFile
0018
0019 #include <SelectMgr_TriangularFrustum.hxx>
0020 #include <gp_Pnt2d.hxx>
0021 #include <NCollection_Array1.hxx>
0022 #include <NCollection_HArray1.hxx>
0023
0024
0025
0026
0027
0028
0029
0030
0031 class SelectMgr_TriangularFrustumSet : public SelectMgr_BaseFrustum
0032 {
0033 public:
0034
0035 struct SelectionPolyline
0036 {
0037 occ::handle<NCollection_HArray1<gp_Pnt2d>> Points;
0038 };
0039
0040 public:
0041
0042 SelectMgr_TriangularFrustumSet();
0043
0044
0045 Standard_EXPORT ~SelectMgr_TriangularFrustumSet() override;
0046
0047
0048 Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt2d>& thePoints);
0049
0050
0051
0052
0053 Standard_EXPORT void Build() override;
0054
0055
0056 bool IsScalable() const override { return false; }
0057
0058
0059 Standard_EXPORT occ::handle<SelectMgr_BaseIntersector> ScaleAndTransform(
0060 const int theScale,
0061 const gp_GTrsf& theTrsf,
0062 const occ::handle<SelectMgr_FrustumBuilder>& theBuilder) const override;
0063
0064
0065
0066
0067
0068
0069
0070 Standard_EXPORT occ::handle<SelectMgr_BaseIntersector> CopyWithBuilder(
0071 const occ::handle<SelectMgr_FrustumBuilder>& theBuilder) const override;
0072
0073 public:
0074 Standard_EXPORT bool OverlapsBox(const NCollection_Vec3<double>& theMinPnt,
0075 const NCollection_Vec3<double>& theMaxPnt,
0076 const SelectMgr_ViewClipRange& theClipRange,
0077 SelectBasics_PickResult& thePickResult) const override;
0078
0079 Standard_EXPORT bool OverlapsBox(const NCollection_Vec3<double>& theMinPnt,
0080 const NCollection_Vec3<double>& theMaxPnt,
0081 bool* theInside) const override;
0082
0083 Standard_EXPORT bool OverlapsPoint(const gp_Pnt& thePnt,
0084 const SelectMgr_ViewClipRange& theClipRange,
0085 SelectBasics_PickResult& thePickResult) const override;
0086
0087
0088 Standard_EXPORT bool OverlapsPoint(const gp_Pnt& thePnt) const override;
0089
0090 Standard_EXPORT bool OverlapsPolygon(const NCollection_Array1<gp_Pnt>& theArrayOfPnts,
0091 Select3D_TypeOfSensitivity theSensType,
0092 const SelectMgr_ViewClipRange& theClipRange,
0093 SelectBasics_PickResult& thePickResult) const override;
0094
0095 Standard_EXPORT bool OverlapsSegment(const gp_Pnt& thePnt1,
0096 const gp_Pnt& thePnt2,
0097 const SelectMgr_ViewClipRange& theClipRange,
0098 SelectBasics_PickResult& thePickResult) const override;
0099
0100 Standard_EXPORT bool OverlapsTriangle(const gp_Pnt& thePnt1,
0101 const gp_Pnt& thePnt2,
0102 const gp_Pnt& thePnt3,
0103 Select3D_TypeOfSensitivity theSensType,
0104 const SelectMgr_ViewClipRange& theClipRange,
0105 SelectBasics_PickResult& thePickResult) const override;
0106
0107 public:
0108
0109
0110 Standard_EXPORT gp_Pnt DetectedPoint(const double theDepth) const override;
0111
0112
0113
0114 Standard_EXPORT bool OverlapsSphere(const gp_Pnt& theCenter,
0115 const double theRadius,
0116 bool* theInside = nullptr) const override;
0117
0118
0119
0120 Standard_EXPORT bool OverlapsSphere(const gp_Pnt& theCenter,
0121 const double theRadius,
0122 const SelectMgr_ViewClipRange& theClipRange,
0123 SelectBasics_PickResult& thePickResult) const override;
0124
0125
0126
0127 Standard_EXPORT bool OverlapsCylinder(const double theBottomRad,
0128 const double theTopRad,
0129 const double theHeight,
0130 const gp_Trsf& theTrsf,
0131 const bool theIsHollow,
0132 const SelectMgr_ViewClipRange& theClipRange,
0133 SelectBasics_PickResult& thePickResult) const override;
0134
0135
0136
0137 Standard_EXPORT bool OverlapsCylinder(const double theBottomRad,
0138 const double theTopRad,
0139 const double theHeight,
0140 const gp_Trsf& theTrsf,
0141 const bool theIsHollow,
0142 bool* theInside = nullptr) const override;
0143
0144
0145
0146 Standard_EXPORT bool OverlapsCircle(const double theBottomRad,
0147 const gp_Trsf& theTrsf,
0148 const bool theIsFilled,
0149 const SelectMgr_ViewClipRange& theClipRange,
0150 SelectBasics_PickResult& thePickResult) const override;
0151
0152
0153
0154 Standard_EXPORT bool OverlapsCircle(const double theBottomRad,
0155 const gp_Trsf& theTrsf,
0156 const bool theIsFilled,
0157 bool* theInside = nullptr) const override;
0158
0159
0160
0161 Standard_EXPORT void GetPlanes(
0162 NCollection_DynamicArray<NCollection_Vec4<double>>& thePlaneEquations) const override;
0163
0164
0165
0166 Standard_EXPORT virtual void SetAllowOverlapDetection(const bool theIsToAllow);
0167
0168
0169 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0170
0171 private:
0172
0173
0174
0175
0176 Standard_EXPORT bool isPointInsideAnyFrustum(const gp_Pnt& thePnt) const;
0177
0178
0179 Standard_EXPORT bool isIntersectBoundary(const gp_Pnt& thePnt1, const gp_Pnt& thePnt2) const;
0180
0181
0182 Standard_EXPORT bool isIntersectBoundary(const double theRadius,
0183 const gp_Trsf& theTrsf,
0184 const bool theIsFilled) const;
0185
0186
0187 Standard_EXPORT static bool segmentTriangleIntersection(const gp_Pnt& theOrig,
0188 const gp_Vec& theDir,
0189 const gp_Pnt& theV1,
0190 const gp_Pnt& theV2,
0191 const gp_Pnt& theV3);
0192
0193 Standard_EXPORT static bool segmentSegmentIntersection(const gp_Pnt& theStartPnt1,
0194 const gp_Pnt& theEndPnt1,
0195 const gp_Pnt& theStartPnt2,
0196 const gp_Pnt& theEndPnt2);
0197
0198 Standard_EXPORT static bool pointInTriangle(const gp_Pnt& thePnt,
0199 const gp_Pnt& theV1,
0200 const gp_Pnt& theV2,
0201 const gp_Pnt& theV3);
0202
0203 private:
0204 NCollection_List<occ::handle<SelectMgr_TriangularFrustum>>
0205 myFrustums;
0206
0207 SelectionPolyline mySelPolyline;
0208 NCollection_Array1<gp_Pnt> myBoundaryPoints;
0209
0210
0211
0212
0213
0214
0215 bool myToAllowOverlap;
0216
0217 };
0218
0219 #endif