DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Lattice.h
1 
17 #pragma once
18 
31 #if defined(Lattice_RECURSES)
32 #error Recursive header files inclusion detected in Lattice.h
33 #else // defined(Lattice_RECURSES)
34 
35 #define Lattice_RECURSES
36 
37 #if !defined Lattice_h
38 
39 #define Lattice_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/CSpace.h"
46 #include "DGtal/kernel/PointVector.h"
48 
49 namespace DGtal
50 {
51 
53  // template class Lattice
61  template <typename TSpace>
62  class Lattice
63  {
64  // ----------------------- Concept checks ------------------------------
66 
67  // ----------------------- Associated types ------------------------------
68  public:
69  typedef TSpace Space;
70  typedef typename TSpace::Integer Integer;
71  typedef typename TSpace::Point Point;
72  typedef typename TSpace::Dimension Dimension;
73 
74 
75  // ----------------------- Static services ------------------------------
76  public:
77 
86  static void defaultZ2toZ3( Lattice & l, const double* x0, double dh = 1.0 );
87 
96  static void defaultZ3toZ3( Lattice & l, const double* x0, double dh = 1.0 );
97 
98  // ----------------------- Standard services ------------------------------
99  public:
100 
104  ~Lattice();
105 
109  Lattice();
110 
115  Lattice ( const Lattice<Space> & other );
116 
122  Lattice<Space> & operator= ( const Lattice<Space> & other );
123 
135  void init( Dimension aN, Dimension aM, double dh = 1.0 );
136 
140  void clear();
141 
145  Dimension n() const;
146 
150  Dimension m() const;
151 
152 
157  void setOrigin( const double* x );
158 
164  void setVector( Dimension i, const double* v );
165 
172  void immerse( const Integer* p, double* x ) const;
173 
180  void immerse( const Point & p, double* x ) const;
181 
188  void immerse( const Integer* p, float* x ) const;
189 
196  void immerse( const Point & p, float* x ) const;
197 
198 
199  // ----------------------- Interface --------------------------------------
200  public:
201 
206  void selfDisplay ( std::ostream & out ) const;
207 
212  bool isValid() const;
213 
214  // ------------------------- Protected Datas ------------------------------
215  private:
216  // ------------------------- Private Datas --------------------------------
217  private:
218 
222  unsigned int myN;
223 
227  unsigned int myM;
228 
232  double* myX0;
233 
237  double* myV;
238 
239 
240  // ------------------------- Hidden services ------------------------------
241  protected:
242 
243 
244  private:
245 
246 
247  // ------------------------- Internals ------------------------------------
248  private:
249 
250  }; // end of class Lattice
251 
252 
259  template <typename TSpace>
260  std::ostream&
261  operator<< ( std::ostream & out, const Lattice<TSpace> & object );
262 
263 } // namespace DGtal
264 
265 
267 // Includes inline functions.
268 #include "DGtal/io/viewers/Lattice.ih"
269 
270 // //
272 
273 #endif // !defined Lattice_h
274 
275 #undef Lattice_RECURSES
276 #endif // else defined(Lattice_RECURSES)