1 // Created on: 2013-12-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // =======================================================================
17 // function : BVH_ObjectSet
19 // =======================================================================
20 template<class T, int N>
21 BVH_ObjectSet<T, N>::BVH_ObjectSet()
26 // =======================================================================
27 // function : ~BVH_ObjectSet
29 // =======================================================================
30 template<class T, int N>
31 BVH_ObjectSet<T, N>::~BVH_ObjectSet()
36 // =======================================================================
37 // function : Clears all geometric objects
39 // =======================================================================
40 template<class T, int N>
41 void BVH_ObjectSet<T, N>::Clear()
43 for (Standard_Integer anObjectIdx = 0; anObjectIdx < myObjects.Size(); ++anObjectIdx)
45 myObjects.ChangeValue (anObjectIdx).Nullify();
50 // =======================================================================
53 // =======================================================================
54 template<class T, int N>
55 typename BVH_ObjectSet<T, N>::BVH_ObjectList& BVH_ObjectSet<T, N>::Objects()
60 // =======================================================================
63 // =======================================================================
64 template<class T, int N>
65 const typename BVH_ObjectSet<T, N>::BVH_ObjectList& BVH_ObjectSet<T, N>::Objects() const
70 // =======================================================================
73 // =======================================================================
74 template<class T, int N>
75 Standard_Integer BVH_ObjectSet<T, N>::Size() const
77 return myObjects.Size();
80 // =======================================================================
83 // =======================================================================
84 template<class T, int N>
85 BVH_Box<T, N> BVH_ObjectSet<T, N>::Box (const Standard_Integer theIndex) const
87 return myObjects.Value (theIndex)->Box();
90 // =======================================================================
93 // =======================================================================
94 template<class T, int N>
95 T BVH_ObjectSet<T, N>::Center (const Standard_Integer theIndex,
96 const Standard_Integer theAxis) const
98 // Note: general implementation, not optimal
99 return BVH::CenterAxis<T, N>::Center (myObjects.Value (theIndex)->Box(), theAxis);
102 // =======================================================================
105 // =======================================================================
106 template<class T, int N>
107 void BVH_ObjectSet<T, N>::Swap (const Standard_Integer theIndex1,
108 const Standard_Integer theIndex2)
110 std::swap (myObjects.ChangeValue (theIndex1),
111 myObjects.ChangeValue (theIndex2));