SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
TooN.h
Go to the documentation of this file.
1 //-*- c++ -*-
2 
3 // Copyright (C) 2005,2009 Tom Drummond (twd20@cam.ac.uk),
4 // Ed Rosten (er258@cam.ac.uk), Gerhard Reitmayr (gr281@cam.ac.uk)
5 //
6 // This file is part of the TooN Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
11 
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // USA.
21 
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
30 
31 
32 #ifndef TOON_INCLUDE_TOON_H
33 #define TOON_INCLUDE_TOON_H
34 #include <iostream>
35 #include <cstdlib>
36 #include <limits>
37 #include <new>
38 #include <utility>
39 #include <vector>
40 #include <complex>
41 #include "config.hh"
42 #include "typeof.hh"
43 #include "deprecated.hh"
44 
45 #if defined TOON_NDEBUG || defined NDEBUG
46  #define TOON_NDEBUG_MISMATCH
47  #define TOON_NDEBUG_SLICE
48  #define TOON_NDEBUG_SIZE
49  #define TOON_NDEBUG_FILL
50 #endif
51 
52 #ifdef TOON_INITIALIZE_RANDOM
53 #include <ctime>
54 #endif
55 
56 #ifdef TOON_USE_LAPACK
57  #ifndef TOON_DETERMINANT_LAPACK
58  #define TOON_DETERMINANT_LAPACK 35
59  #endif
60 #endif
61 
63 namespace TooN {
64 
65 #ifdef TOON_TEST_INTERNALS
66  namespace Internal
67  {
68  struct BadIndex{};
69  struct SliceError{};
70  struct StaticSliceError{};
71  struct SizeMismatch{};
72  struct StaticSizeMismatch{};
73  struct VectorOverfill{};
74  struct StaticVectorOverfill{};
75  struct MatrixOverfill{};
76  struct StaticMatrixOverfill{};
77  struct Underfill{};
78  }
79 #endif
80 
81  using std::numeric_limits;
101  template<class C> struct IsField
102  {
103  static const int value = numeric_limits<C>::is_specialized;
104  };
105 
106  template<class C> struct IsField<std::complex<C> >
107  {
108  static const int value = numeric_limits<C>::is_specialized;
109  };
110 
115  template<class C> struct IsField<const C>
116  {
117  static const int value = IsField<C>::value;
118  };
119 
120  template<class C, class D> struct These_Types_Do_Not_Form_A_Field;
121 
124  namespace Internal
125  {
129  static const unsigned int max_bytes_on_stack=1000;
133  struct Slicing{};
134  template<int RowStride, int ColStride> struct Slice;
135  template<int Size, typename Precision, int Stride, typename Mem> struct GenericVBase;
136  }
137 
138  template<int Size, class Precision, class Base> struct Vector;
139  template<int Rows, int Cols, class Precision, class Base> struct Matrix;
140  template<int Size, class Precision, class Base> struct DiagonalMatrix;
141 
142 
143  #ifdef DOXYGEN_INCLUDE_ONLY_FOR_DOCS
144  template<typename T> struct Operator{
173 
175  int size() const;
177  int num_rows() const;
179  int num_cols() const;
181 
184 
187  template<int Size, class Precision, class Base>
188  void eval(Vector<Size, Precision, Base>& v) const;
189 
191  template <int Size, typename P1, typename B1>
192  void plusequals(Vector<Size, P1, B1>& v) const;
193 
195  template <int Size, typename P1, typename B1>
196  void minusequals(Vector<Size, P1, B1>& v) const;
197 
200  template <int Size, typename P1, typename B1>
201  Operator<T> add(const Vector<Size, P1, B1>& v) const;
202 
204  template <int Size, typename P1, typename B1>
205  Operator<T> rsubtract(const Vector<Size, P1, B1>& v) const;
206 
208  template <int Size, typename P1, typename B1>
209  Operator<T> lsubtract(const Vector<Size, P1, B1>& v) const;
210 
212 
217  template<int R, int C, class P, class B>
218  void eval(Matrix<R,C,P,B>& m) const;
219 
222  template <int Rows, int Cols, typename P1, typename B1>
223  Operator<T> add(const Matrix<Rows,Cols, P1, B1>& m) const;
224 
225 
227  template <int Rows, int Cols, typename P1, typename B1>
228  Operator<T> rsubtract(const Matrix<Rows,Cols, P1, B1>& m) const;
229 
231  template <int Rows, int Cols, typename P1, typename B1>
232  Operator<T> lsubtract(const Matrix<Rows,Cols, P1, B1>& m) const;
233 
235  template <int Rows, int Cols, typename P1, typename B1>
236  void plusequals(Matrix<Rows,Cols, P1, B1>& m) const;
237 
239  template <int Rows, int Cols, typename P1, typename B1>
240  void minusequals(Matrix<Rows,Cols, P1, B1>& m) const;
242 
243 
246 
249  Operator<T> operator()(int size) const;
250 
252  Operator<T> operator()(int num_rows, int num_cols) const;
254 
257  typedef T Precision;
258 
260  template<class Pout, class Pmult> Operator<Internal::Identity<Pout> > scale_me(const Pmult& m) const
261  {
262  return Operator<Internal::Identity<Pout> >(val*m);
263  }
265 
266  };
267  #else
268  template<typename T> struct Operator;
269  #endif
270 
272  static const int Dynamic = -1;
273  static const int Resizable = -0x7fffffff;
274 
275  namespace Internal
276  {
277  template<int i, int j> struct SimpleSizer{static const int size=i;};
278  template<int i> struct SimpleSizer<Dynamic, i>{static const int size=i;};
279  template<int i> struct SimpleSizer<i, Dynamic>{static const int size=i;};
280  template<> struct SimpleSizer<Dynamic, Dynamic> {static const int size=-1;};
281 
282  template<int i> struct IsStatic
283  {
284  static const bool is = (i!=Dynamic && i != Resizable);
285  };
286 
287  //Choose an output size, given a pair of input sizes. Be static if possible.
288  template<int i, int j=i> struct Sizer{
290  };
291 
292  //Choose an output size, given an input size. Be static if possible.
293  //Otherwise be dynamic. Never generate a resizable vector.
294  template<int i> struct Sizer<i,i>{
295  static const int size = IsStatic<i>::is?i:Dynamic;
296  };
297  }
298 
300 #ifndef TOON_DEFAULT_PRECISION
301  typedef double DefaultPrecision;
302 #else
303  typedef TOON_DEFAULT_PRECISION DefaultPrecision;
304 #endif
305 }
306 
307 #include "dchecktest.hh"
308 #include "allocator.hh"
309 
310 #include "size_mismatch.hh"
311 #include "overfill_error.hh"
312 #include "slice_error.hh"
313 #include "debug.hh"
314 
315 #include "comma.hh"
316 
317 #include "vbase.hh"
318 #include "vector.hh"
319 
320 #include "mbase.hh"
321 #include "matrix.hh"
322 #include "reference.hh"
323 
324 #include "make_vector.hh"
325 #include "operators.hh"
326 
327 #include "objects.h"
328 
329 #include "diagmatrix.h"
330 
331 #include "data.hh"
332 #include "data_functions.hh"
333 
334 #include "helpers.h"
335 
336 #endif
static const bool is
Definition: TooN.h:284
static const int value
Is C a field?
Definition: TooN.h:103
Everything lives inside this namespace.
Definition: allocator.hh:48
static const int Dynamic
Template size value used to indicate dynamically sized vectors and matrices.
Definition: TooN.h:272
double DefaultPrecision
All TooN classes default to using this precision for computations and storage.
Definition: TooN.h:301
static const int size
Definition: TooN.h:289
static const int Resizable
Definition: TooN.h:273
static const unsigned int max_bytes_on_stack
Definition: TooN.h:129
static const int size
Definition: TooN.h:277