File indexing completed on 2026-09-11 09:17:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BVH_ObjectSet_HeaderFile
0017 #define BVH_ObjectSet_HeaderFile
0018
0019 #include <BVH_Set.hxx>
0020 #include <BVH_Object.hxx>
0021 #include <NCollection_DynamicArray.hxx>
0022
0023
0024
0025
0026 template <class T, int N>
0027 class BVH_ObjectSet : public BVH_Set<T, N>
0028 {
0029 public:
0030
0031 typedef NCollection_DynamicArray<opencascade::handle<BVH_Object<T, N>>> BVH_ObjectList;
0032
0033 public:
0034
0035 BVH_ObjectSet() = default;
0036
0037
0038 ~BVH_ObjectSet() override = default;
0039
0040 public:
0041
0042 virtual void Clear()
0043 {
0044 for (typename BVH_ObjectList::Iterator anObjectIter(myObjects); anObjectIter.More();
0045 anObjectIter.Next())
0046 {
0047 anObjectIter.ChangeValue().Nullify();
0048 }
0049 myObjects.Clear();
0050 }
0051
0052
0053 BVH_ObjectList& Objects() { return myObjects; }
0054
0055
0056 const BVH_ObjectList& Objects() const { return myObjects; }
0057
0058 public:
0059
0060 int Size() const override { return myObjects.Length(); }
0061
0062
0063 using BVH_Set<T, N>::Box;
0064
0065
0066 BVH_Box<T, N> Box(const int theIndex) const override { return myObjects.Value(theIndex)->Box(); }
0067
0068
0069 T Center(const int theIndex, const int theAxis) const override
0070 {
0071
0072 return BVH::CenterAxis<T, N>::Center(myObjects.Value(theIndex)->Box(), theAxis);
0073 }
0074
0075
0076 void Swap(const int theIndex1, const int theIndex2) override
0077 {
0078 std::swap(myObjects.ChangeValue(theIndex1), myObjects.ChangeValue(theIndex2));
0079 }
0080
0081 protected:
0082 BVH_ObjectList myObjects;
0083 };
0084
0085 #endif