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.
comma.hh
Go to the documentation of this file.
1 namespace TooN{
2 
3 
4 
5 namespace Internal
6 {
7  template<int N, int Size, class P, class B> struct VectorFiller
8  {
10  VectorFiller<N-1, Size, P, B>* parent;
11  bool underfill;
12 
14  :v(v_),parent(p),underfill(N<v.size())
15  {
16  }
17 
19  {
21  v[N] = p;
22  return VectorFiller<N+1, Size, P, B>(v, this);
23  }
24 
26  {
27  #ifndef TOON_NDEBUG_FILL
28  if(underfill)
29  {
30  #ifdef TOON_TEST_INTERNALS
31  throw Internal::Underfill();
32  #else
33  std::cerr << "TooN: underfilled vector\n";
34  std::abort();
35  #endif
36  }
37  else if(parent)
38  parent->underfill = 0;
39  #endif
40  }
41  };
42 
43  template<int Size, class P, class B> struct VectorStartFill
44  {
47  :v(v_){}
48 
50  {
52  v[0] = p;
53  return VectorFiller<1, Size, P, B>(v, 0);
54  }
55  };
56 
57 
58  template<int N, int R, int C, class P, class B> struct MatrixFiller
59  {
61  MatrixFiller<N-1, R, C, P, B>* parent;
62  int r, c;
63  bool underfill;
64 
66  :m(m_),parent(p),r(r_),c(c_),underfill(r < m.num_rows())
67  {}
68 
70  {
71  Internal::CheckMOverFill<N, R, C>::check(m.num_rows() * m.num_cols());
72  m[r][c] = p;
73  c++;
74  if(c == m.num_cols())
75  {
76  c=0;
77  r++;
78  }
79 
80  return MatrixFiller<N+1, R, C, P, B>(m, this, r, c);
81  }
82 
84  {
85  #ifndef TOON_NDEBUG_FILL
86  if(underfill)
87  {
88  #ifdef TOON_TEST_INTERNALS
89  throw Internal::Underfill();
90  #else
91  std::cerr << "TooN: underfilled matrix\n";
92  std::abort();
93  #endif
94  }
95  else if(parent)
96  parent->underfill = 0;
97  #endif
98  }
99  };
100 
101  template<int R, int C, class P, class B> struct MatrixStartFill
102  {
105  :m(m_){}
106 
108  {
109  Internal::CheckMOverFill<0, R, C>::check(m.num_rows() * m.num_cols());
110  m[0][0] = p;
111  return MatrixFiller<1, R, C, P, B>(m, 0, 0, 1);
112  }
113  };
114 
115 }
116 
130 template<int R, int C, class Precision, class Base> Internal::MatrixStartFill<R, C, Precision, Base> Fill(Matrix<R, C, Precision, Base>& m)
131 {
132  return m;
133 }
134 
148 {
149  return v;
150 }
151 
152 }
Internal::MatrixStartFill< R, C, Precision, Base > Fill(Matrix< R, C, Precision, Base > &m)
Definition: comma.hh:130
VectorFiller< N-1, Size, P, B > * parent
Definition: comma.hh:10
VectorStartFill(Vector< Size, P, B > &v_)
Definition: comma.hh:46
MatrixStartFill(Matrix< R, C, P, B > &m_)
Definition: comma.hh:104
MatrixFiller< N+1, R, C, P, B > operator,(const P &p)
Definition: comma.hh:69
Vector< Size, P, B > & v
Definition: comma.hh:9
Everything lives inside this namespace.
Definition: allocator.hh:48
VectorFiller< 1, Size, P, B > operator=(const P &p)
Definition: comma.hh:49
Matrix< R, C, P, B > & m
Definition: comma.hh:60
MatrixFiller(Matrix< R, C, P, B > &m_, MatrixFiller< N-1, R, C, P, B > *p, int r_, int c_)
Definition: comma.hh:65
MatrixFiller< N-1, R, C, P, B > * parent
Definition: comma.hh:61
Matrix< R, C, P, B > & m
Definition: comma.hh:103
VectorFiller< N+1, Size, P, B > operator,(const P &p)
Definition: comma.hh:18
VectorFiller(Vector< Size, P, B > &v_, VectorFiller< N-1, Size, P, B > *p)
Definition: comma.hh:13
MatrixFiller< 1, R, C, P, B > operator=(const P &p)
Definition: comma.hh:107
Vector< Size, P, B > & v
Definition: comma.hh:45