File indexing completed on 2025-01-18 10:03:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOPTools_BoxSelector_HeaderFile
0016 #define BOPTools_BoxSelector_HeaderFile
0017
0018 #include <BVH_Traverse.hxx>
0019 #include <BVH_BoxSet.hxx>
0020
0021 #include <Standard_Integer.hxx>
0022 #include <TColStd_ListOfInteger.hxx>
0023
0024
0025 template <int Dimension>
0026 class BOPTools_BoxSelector :
0027 public BVH_Traverse <Standard_Real, Dimension, BVH_BoxSet <Standard_Real, Dimension, Standard_Integer>, Standard_Boolean>
0028 {
0029 public:
0030
0031 typedef typename BVH::VectorType<Standard_Real, Dimension>::Type BVH_VecNd;
0032
0033 public:
0034
0035
0036 BOPTools_BoxSelector() {};
0037
0038 public:
0039
0040
0041 void Clear()
0042 {
0043 myIndices.Clear();
0044 }
0045
0046
0047 void SetBox (const BVH_Box <Standard_Real, Dimension>& theBox)
0048 {
0049 myBox = theBox;
0050 }
0051
0052
0053 const TColStd_ListOfInteger& Indices() const
0054 {
0055 return myIndices;
0056 }
0057
0058 public:
0059
0060
0061 virtual Standard_Boolean RejectNode (const BVH_VecNd& theCMin,
0062 const BVH_VecNd& theCMax,
0063 Standard_Boolean& theIsInside) const Standard_OVERRIDE
0064 {
0065 Standard_Boolean hasOverlap;
0066 theIsInside = myBox.Contains (theCMin, theCMax, hasOverlap);
0067 return !hasOverlap;
0068 }
0069
0070
0071 Standard_Boolean RejectElement (const Standard_Integer theIndex)
0072 {
0073 return myBox.IsOut (this->myBVHSet->Box (theIndex));
0074 }
0075
0076
0077 virtual Standard_Boolean AcceptMetric (const Standard_Boolean& theIsInside) const Standard_OVERRIDE
0078 {
0079 return theIsInside;
0080 }
0081
0082
0083 virtual Standard_Boolean Accept (const Standard_Integer theIndex,
0084 const Standard_Boolean& theIsInside) Standard_OVERRIDE
0085 {
0086 if (theIsInside || !RejectElement (theIndex))
0087 {
0088 myIndices.Append (this->myBVHSet->Element (theIndex));
0089 return Standard_True;
0090 }
0091 return Standard_False;
0092 }
0093
0094 protected:
0095
0096 BVH_Box <Standard_Real, Dimension> myBox;
0097 TColStd_ListOfInteger myIndices;
0098 };
0099
0100 #endif