Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:33

0001 // Created on: 2013-12-20
0002 // Created by: Denis BOGOLEPOV
0003 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef BVH_Set_HeaderFile
0017 #define BVH_Set_HeaderFile
0018 
0019 #include <BVH_Box.hxx>
0020 
0021 //! Set of abstract entities (bounded by BVH boxes). This is
0022 //! the minimal geometry interface needed to construct BVH.
0023 //! \tparam T Numeric data type
0024 //! \tparam N Vector dimension
0025 template <class T, int N>
0026 class BVH_Set
0027 {
0028 public:
0029   typedef BVH_Box<T, N> BVH_BoxNt;
0030 
0031 public:
0032   //! Creates new abstract set of objects.
0033   BVH_Set() = default;
0034 
0035   //! Releases resources of set of objects.
0036   virtual ~BVH_Set() = default;
0037 
0038   //! Returns AABB of the entire set of objects.
0039   virtual BVH_Box<T, N> Box() const
0040   {
0041     BVH_Box<T, N> aBox;
0042     const int     aSize = Size();
0043     for (int anIndex = 0; anIndex < aSize; ++anIndex)
0044     {
0045       aBox.Combine(Box(anIndex));
0046     }
0047     return aBox;
0048   }
0049 
0050 public:
0051   //! Returns total number of objects.
0052   virtual int Size() const = 0;
0053 
0054   //! Returns AABB of the given object.
0055   virtual BVH_Box<T, N> Box(const int theIndex) const = 0;
0056 
0057   //! Returns centroid position along the given axis.
0058   virtual T Center(const int theIndex, const int theAxis) const = 0;
0059 
0060   //! Performs transposing the two given objects in the set.
0061   virtual void Swap(const int theIndex1, const int theIndex2) = 0;
0062 };
0063 
0064 #endif // _BVH_Set_Header