sensorfw
coordinatealignfilter.h
Go to the documentation of this file.
1
26
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 TMatrix &operator=(const TMatrix &other) {
51 setMatrix(other.data_);
52 return *this;
53 }
54
55 double get(int i, int j) const {
56 if (i >= DIM || j >= DIM || i < 0 || j < 0) {
57 qWarning("Index out of bounds");
58 return 0;
59 }
60 return data_[i][j];
61 };
62
63 void setMatrix(const double m[DIM][DIM]) {
64 memcpy(data_, m, sizeof(double[DIM][DIM]));
65 }
66
67 double data_[DIM][DIM];
68};
70
79class CoordinateAlignFilter : public QObject, public Filter<TimedXyzData, CoordinateAlignFilter, TimedXyzData>
80{
81 Q_OBJECT;
82 Q_PROPERTY(TMatrix transMatrix READ matrix WRITE setMatrix);
83public:
84
89 static FilterBase* factoryMethod() {
90 return new CoordinateAlignFilter;
91 }
92
93 const TMatrix& matrix() const { return matrix_; }
94
95 void setMatrix(const TMatrix& matrix) { matrix_ = matrix; }
96
97protected:
102
103private:
104 void filter(unsigned, const TimedXyzData*);
105
106 TMatrix matrix_;
107};
108
109#endif // COORDINATEALIGNFILTER_H
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 & operator=(const TMatrix &other)
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.