3c4e78f2 |
1 | // Created on: 2013-12-20 |
2 | // Created by: Denis BOGOLEPOV |
d5f74e42 |
3 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
3c4e78f2 |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
3c4e78f2 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BVH_Builder_Header |
17 | #define _BVH_Builder_Header |
18 | |
19 | #include <BVH_Set.hxx> |
20 | #include <BVH_Tree.hxx> |
21 | |
3c4e78f2 |
22 | namespace |
23 | { |
24 | //! Minimum node size to split. |
25 | const Standard_Real THE_NODE_MIN_SIZE = 1e-5; |
26 | } |
27 | |
28 | //! Performs building of BVH tree. |
29 | template<class T, int N> |
30 | class BVH_Builder |
31 | { |
32 | public: |
33 | |
34 | //! Creates abstract BVH builder. |
35 | BVH_Builder (const Standard_Integer theLeafNodeSize, |
36 | const Standard_Integer theMaxTreeDepth); |
37 | |
38 | //! Releases resources of BVH builder. |
0ef61b50 |
39 | virtual ~BVH_Builder(); |
3c4e78f2 |
40 | |
41 | public: |
42 | |
43 | //! Builds BVH using specified algorithm. |
0ef61b50 |
44 | virtual void Build (BVH_Set<T, N>* theSet, |
45 | BVH_Tree<T, N>* theBVH, |
46 | const BVH_Box<T, N>& theBox) = 0; |
3c4e78f2 |
47 | |
fc73a202 |
48 | //! Updates depth of constructed BVH tree. |
49 | void UpdateDepth (BVH_Tree<T, N>* theBVH, |
50 | const Standard_Integer theLevel) |
51 | { |
52 | if (theLevel > theBVH->myDepth) |
53 | { |
54 | theBVH->myDepth = theLevel; |
55 | } |
56 | } |
57 | |
3c4e78f2 |
58 | protected: |
59 | |
60 | Standard_Integer myMaxTreeDepth; //!< Maximum depth of constructed BVH |
61 | Standard_Integer myLeafNodeSize; //!< Maximum number of primitives per leaf |
3c4e78f2 |
62 | |
63 | }; |
64 | |
65 | #include <BVH_Builder.lxx> |
66 | |
67 | #endif // _BVH_Builder_Header |