File indexing completed on 2026-10-02 09:11:28
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 <NCollection_List.hxx>
0023
0024
0025 template <int Dimension>
0026 class BOPTools_BoxSelector
0027 : public BVH_Traverse<double, Dimension, BVH_BoxSet<double, Dimension, int>, bool>
0028 {
0029 public:
0030 typedef typename BVH::VectorType<double, Dimension>::Type BVH_VecNd;
0031
0032 public:
0033
0034 BOPTools_BoxSelector() = default;
0035
0036 public:
0037
0038 void Clear() { myIndices.Clear(); }
0039
0040
0041 void SetBox(const BVH_Box<double, Dimension>& theBox) { myBox = theBox; }
0042
0043
0044 const NCollection_List<int>& Indices() const { return myIndices; }
0045
0046 public:
0047
0048 bool RejectNode(const BVH_VecNd& theCMin,
0049 const BVH_VecNd& theCMax,
0050 bool& theIsInside) const override
0051 {
0052 bool hasOverlap;
0053 theIsInside = myBox.Contains(theCMin, theCMax, hasOverlap);
0054 return !hasOverlap;
0055 }
0056
0057
0058 bool RejectElement(const int theIndex) { return myBox.IsOut(this->myBVHSet->Box(theIndex)); }
0059
0060
0061 bool AcceptMetric(const bool& theIsInside) const override { return theIsInside; }
0062
0063
0064 bool Accept(const int theIndex, const bool& theIsInside) override
0065 {
0066 if (theIsInside || !RejectElement(theIndex))
0067 {
0068 myIndices.Append(this->myBVHSet->Element(theIndex));
0069 return true;
0070 }
0071 return false;
0072 }
0073
0074 protected:
0075 BVH_Box<double, Dimension> myBox;
0076 NCollection_List<int> myIndices;
0077 };
0078
0079 #endif