0026292: Visualization - Parallelize queue-based BVH builders (subclasses of BVH_Queu...
[occt.git] / src / BVH / BVH_ObjectSet.lxx
CommitLineData
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// =======================================================================
17// function : BVH_ObjectSet
18// purpose :
19// =======================================================================
20template<class T, int N>
21BVH_ObjectSet<T, N>::BVH_ObjectSet()
22{
23 //
24}
25
26// =======================================================================
27// function : ~BVH_ObjectSet
28// purpose :
29// =======================================================================
30template<class T, int N>
31BVH_ObjectSet<T, N>::~BVH_ObjectSet()
32{
33 //
34}
35
36// =======================================================================
37// function : Clears all geometric objects
38// purpose :
39// =======================================================================
40template<class T, int N>
41void BVH_ObjectSet<T, N>::Clear()
42{
43 for (Standard_Integer anObjectIdx = 0; anObjectIdx < myObjects.Size(); ++anObjectIdx)
44 {
45 myObjects.ChangeValue (anObjectIdx).Nullify();
46 }
47 myObjects.Clear();
48}
49
50// =======================================================================
51// function : Objects
52// purpose :
53// =======================================================================
54template<class T, int N>
55typename BVH_ObjectSet<T, N>::BVH_ObjectList& BVH_ObjectSet<T, N>::Objects()
56{
57 return myObjects;
58}
59
60// =======================================================================
61// function : Objects
62// purpose :
63// =======================================================================
64template<class T, int N>
65const typename BVH_ObjectSet<T, N>::BVH_ObjectList& BVH_ObjectSet<T, N>::Objects() const
66{
67 return myObjects;
68}
69
70// =======================================================================
71// function : Size
72// purpose :
73// =======================================================================
74template<class T, int N>
75Standard_Integer BVH_ObjectSet<T, N>::Size() const
76{
77 return myObjects.Size();
78}
79
80// =======================================================================
81// function : Box
82// purpose :
83// =======================================================================
84template<class T, int N>
85BVH_Box<T, N> BVH_ObjectSet<T, N>::Box (const Standard_Integer theIndex) const
86{
87 return myObjects.Value (theIndex)->Box();
88}
89
90// =======================================================================
91// function : Center
92// purpose :
93// =======================================================================
94template<class T, int N>
95T BVH_ObjectSet<T, N>::Center (const Standard_Integer theIndex,
96 const Standard_Integer theAxis) const
97{
679d3878 98 // Note: general implementation, not optimal
99 return BVH::CenterAxis<T, N>::Center (myObjects.Value (theIndex)->Box(), theAxis);
3c4e78f2 100}
101
102// =======================================================================
103// function : Swap
104// purpose :
105// =======================================================================
106template<class T, int N>
107void BVH_ObjectSet<T, N>::Swap (const Standard_Integer theIndex1,
108 const Standard_Integer theIndex2)
109{
679d3878 110 std::swap (myObjects.ChangeValue (theIndex1),
111 myObjects.ChangeValue (theIndex2));
3c4e78f2 112}