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
36class TMatrix {
37private:
38 static const int DIM = 3;
39
40public:
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
75class CoordinateAlignFilter : public QObject, public Filter<TimedXyzData, CoordinateAlignFilter, TimedXyzData>
76{
77 Q_OBJECT;
78 Q_PROPERTY(TMatrix transMatrix READ matrix WRITE setMatrix);
79public:
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
93protected:
98
99private:
100 void filter(unsigned, const TimedXyzData*);
101
102 TMatrix matrix_;
103};
104
105#endif // COORDINATEALIGNFILTER_H
Coordinate alignment filter.
const TMatrix & matrix() const
static FilterBase * factoryMethod()
Factory method.
void setMatrix(const TMatrix &matrix)
CoordinateAlignFilter()
Constructor.
TMatrix holds a transformation matrix.
double get(int i, int j) const
TMatrix(const TMatrix &other)
double data_[DIM][DIM]
void setMatrix(const double m[DIM][DIM])
TMatrix(double m[][DIM])
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
Q_DECLARE_METATYPE(TMatrix)
Datatypes for different filters.