sensorfw
coordinatealignfilter.h
Go to the documentation of this file.
1 
27 #ifndef COORDINATEALIGNFILTER_H
28 #define COORDINATEALIGNFILTER_H
29 
31 #include "filter.h"
32 
36 class TMatrix {
37 private:
38  static const int DIM = 3;
39 
40 public:
41  TMatrix() {
42  setMatrix((const double[DIM][DIM]){{1,0,0},{0,1,0},{0,0,1}});
43  }
44  TMatrix(const TMatrix& other) {
45  setMatrix(other.data_);
46  }
47  TMatrix(double m[][DIM]) {
48  setMatrix(m);
49  }
50 
51  double get(int i, int j) const {
52  if (i >= DIM || j >= DIM || i < 0 || j < 0) {
53  qWarning("Index out of bounds");
54  return 0;
55  }
56  return data_[i][j];
57  };
58 
59  void setMatrix(const double m[DIM][DIM]) {
60  memcpy(data_, m, sizeof(double[DIM][DIM]));
61  }
62 
63  double data_[DIM][DIM];
64 };
66 
75 class CoordinateAlignFilter : public QObject, public Filter<TimedXyzData, CoordinateAlignFilter, TimedXyzData>
76 {
77  Q_OBJECT;
78  Q_PROPERTY(TMatrix transMatrix READ matrix WRITE setMatrix);
79 public:
80 
85  static FilterBase* factoryMethod() {
86  return new CoordinateAlignFilter;
87  }
88 
89  const TMatrix& matrix() const { return matrix_; }
90 
91  void setMatrix(const TMatrix& matrix) { matrix_ = matrix; }
92 
93 protected:
98 
99 private:
100  void filter(unsigned, const TimedXyzData*);
101 
102  TMatrix matrix_;
103 };
104 
105 #endif // COORDINATEALIGNFILTER_H
CoordinateAlignFilter()
Constructor.
Q_DECLARE_METATYPE(TMatrix)
Datatypes for different filters.
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:52
TMatrix holds a transformation matrix.
TMatrix(double m[][DIM])
void setMatrix(const double m[DIM][DIM])
TMatrix(const TMatrix &other)
const TMatrix & matrix() const
Coordinate alignment filter.
double data_[DIM][DIM]
void setMatrix(const TMatrix &matrix)
static FilterBase * factoryMethod()
Factory method.