uLib-0.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
StructuredGrid.h
Go to the documentation of this file.
1 /*//////////////////////////////////////////////////////////////////////////////
2 // CMT Cosmic Muon Tomography project //////////////////////////////////////////
4 
5  Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
6  All rights reserved
7 
8  Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
9 
10  ------------------------------------------------------------------
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library.
23 
25 
26 
27 
28 #ifndef U_MATH_STRUCTUREDGRID_H
29 #define U_MATH_STRUCTUREDGRID_H
30 
31 #include "Math/ContainerBox.h"
32 #include "Math/StructuredData.h"
33 
34 namespace uLib {
35 
36 
37 class StructuredGrid : public ContainerBox, public StructuredData {
38  typedef ContainerBox BaseClass;
39 public:
40  StructuredGrid(const Vector3i &size);
41 
42  // TODO: Add SetSize of Container .. adjusting spacing //
43 
44  using ContainerBox::SetOrigin;
45 
46  inline void SetSpacing(const Vector3f &spacing);
47 
48  inline Vector3f GetSpacing() const;
49 
50  bool IsInsideBounds(const Vector4f &pt) const;
51 
52  Vector3i Find(const HPoint3f &pt) const;
53 
54  void PrintSelf(std::ostream &o);
55 };
56 
57 
58 
59 // --- INLINES -------------------------------------------------------------- //
60 
61 inline void StructuredGrid::SetSpacing(const Vector3f &spacing)
62 {
63  ContainerBox::SetSize(spacing);
64 }
65 
66 inline Vector3f StructuredGrid::GetSpacing() const
67 {
68  return ContainerBox::GetSize();
69 }
70 
71 
72 }
73 
74 #endif // STRUCTUREDGRID_H