0025159: Collections and common types in BVH package are named in non-conformant...
[occt.git] / src / BVH / BVH_QueueBuilder.lxx
CommitLineData
0ef61b50 1// Created on: 2014-09-15
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 2013-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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
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// =======================================================================
17// function : BVH_QueueBuilder
18// purpose : Creates new BVH queue based builder
19// =======================================================================
20template<class T, int N>
21BVH_QueueBuilder<T, N>::BVH_QueueBuilder (const Standard_Integer theLeafNodeSize,
22 const Standard_Integer theMaxTreeDepth)
23: BVH_Builder<T, N> (theLeafNodeSize,
24 theMaxTreeDepth)
25{
26 //
27}
28
29// =======================================================================
30// function : ~BVH_QueueBuilder
31// purpose : Releases resources of BVH queue based builder
32// =======================================================================
33template<class T, int N>
34BVH_QueueBuilder<T, N>::~BVH_QueueBuilder()
35{
36 //
37}
38
39// =======================================================================
40// function : Build
41// purpose : Builds BVH using specific algorithm
42// =======================================================================
43template<class T, int N>
44void BVH_QueueBuilder<T, N>::Build (BVH_Set<T, N>* theSet,
45 BVH_Tree<T, N>* theBVH,
46 const BVH_Box<T, N>& theBox)
47{
48 if (theBVH == NULL)
49 {
50 return;
51 }
52
53 theBVH->Clear();
54 if (theSet->Size() == 0)
55 {
56 return;
57 }
58
59 const Standard_Integer aRoot = theBVH->AddLeafNode (theBox, 0, theSet->Size() - 1);
60 if (theSet->Size() == 1)
61 {
62 return;
63 }
64
65 myTasksQueue.Append (aRoot);
66 for (Standard_Integer aTask = 0; aTask < myTasksQueue.Size(); ++aTask)
67 {
68 BuildNode (theSet, theBVH, myTasksQueue.Value (aTask));
69 }
70
71 myTasksQueue.Clear();
72}
73
74// =======================================================================
75// function : BuildNode
76// purpose : Builds BVH node for the given task info
77// =======================================================================
78template<class T, int N>
79void BVH_QueueBuilder<T, N>::BuildNode (BVH_Set<T, N>* /* theSet */,
80 BVH_Tree<T, N>* /* theBVH */,
81 const Standard_Integer /* theTask */)
82{
83 // needed to disable compile warnings
84}