Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:19

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 
0030   typedef BVH_Box<T, N> BVH_BoxNt;
0031 
0032 public:
0033 
0034   //! Creates new abstract set of objects.
0035   BVH_Set() {}
0036 
0037   //! Releases resources of set of objects.
0038   virtual ~BVH_Set() {}
0039 
0040   //! Returns AABB of the entire set of objects.
0041   virtual BVH_Box<T, N> Box() const
0042   {
0043     BVH_Box<T, N> aBox;
0044     const Standard_Integer aSize = Size();
0045     for (Standard_Integer anIndex = 0; anIndex < aSize; ++anIndex)
0046     {
0047       aBox.Combine (Box (anIndex));
0048     }
0049     return aBox;
0050   }
0051 
0052 public:
0053 
0054   //! Returns total number of objects.
0055   virtual Standard_Integer Size() const = 0;
0056 
0057   //! Returns AABB of the given object.
0058   virtual BVH_Box<T, N> Box (const Standard_Integer theIndex) const = 0;
0059 
0060   //! Returns centroid position along the given axis.
0061   virtual T Center (const Standard_Integer theIndex,
0062                     const Standard_Integer theAxis) const = 0;
0063 
0064   //! Performs transposing the two given objects in the set.
0065   virtual void Swap (const Standard_Integer theIndex1,
0066                      const Standard_Integer theIndex2) = 0;
0067 
0068 };
0069 
0070 #endif // _BVH_Set_Header