0026650: Coding rules - fix misprint in NCollection_Vec3::operator/()
[occt.git] / src / BVH / BVH_ObjectSet.lxx
1 // Created on: 2013-12-20
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_ObjectSet
18 // purpose  :
19 // =======================================================================
20 template<class T, int N>
21 BVH_ObjectSet<T, N>::BVH_ObjectSet()
22 {
23   //
24 }
25
26 // =======================================================================
27 // function : ~BVH_ObjectSet
28 // purpose  :
29 // =======================================================================
30 template<class T, int N>
31 BVH_ObjectSet<T, N>::~BVH_ObjectSet()
32 {
33   //
34 }
35
36 // =======================================================================
37 // function : Clears all geometric objects
38 // purpose  :
39 // =======================================================================
40 template<class T, int N>
41 void 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 // =======================================================================
54 template<class T, int N>
55 typename BVH_ObjectSet<T, N>::BVH_ObjectList& BVH_ObjectSet<T, N>::Objects()
56 {
57   return myObjects;
58 }
59
60 // =======================================================================
61 // function : Objects
62 // purpose  :
63 // =======================================================================
64 template<class T, int N>
65 const 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 // =======================================================================
74 template<class T, int N>
75 Standard_Integer BVH_ObjectSet<T, N>::Size() const
76 {
77   return myObjects.Size();
78 }
79
80 // =======================================================================
81 // function : Box
82 // purpose  :
83 // =======================================================================
84 template<class T, int N>
85 BVH_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 // =======================================================================
94 template<class T, int N>
95 T BVH_ObjectSet<T, N>::Center (const Standard_Integer theIndex,
96                                const Standard_Integer theAxis) const
97 {
98   // Note: general implementation, not optimal
99   return BVH::CenterAxis<T, N>::Center (myObjects.Value (theIndex)->Box(), theAxis);
100 }
101
102 // =======================================================================
103 // function : Swap
104 // purpose  :
105 // =======================================================================
106 template<class T, int N>
107 void BVH_ObjectSet<T, N>::Swap (const Standard_Integer theIndex1,
108                                 const Standard_Integer theIndex2)
109 {
110   std::swap (myObjects.ChangeValue (theIndex1),
111              myObjects.ChangeValue (theIndex2));
112 }