sensorfw: filters/coordinatealignfilter/coordinatealignfilter.h Source File

sensorfw

coordinatealignfilter.h
Go to the documentation of this file.
1
27 #ifndef COORDINATEALIGNFILTER_H
28 #define COORDINATEALIGNFILTER_H
29
30 #include "datatypes/orientationdata.h"
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 };
65 Q_DECLARE_METATYPE(TMatrix);
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:
97 CoordinateAlignFilter();
98
99 private:
100 void filter(unsigned, const TimedXyzData*);
101
102 TMatrix matrix_;
103 };
104
105 #endif // COORDINATEALIGNFILTER_H
CoordinateAlignFilter
Coordinate alignment filter.
Definition: coordinatealignfilter.h:76
CoordinateAlignFilter::transMatrix
TMatrix transMatrix
Definition: coordinatealignfilter.h:77
CoordinateAlignFilter::factoryMethod
static FilterBase * factoryMethod()
Factory method.
Definition: coordinatealignfilter.h:85
CoordinateAlignFilter::setMatrix
void setMatrix(const TMatrix &matrix)
Definition: coordinatealignfilter.h:91
CoordinateAlignFilter::CoordinateAlignFilter
CoordinateAlignFilter()
Constructor.
CoordinateAlignFilter::matrix
const TMatrix & matrix() const
Definition: coordinatealignfilter.h:89
TMatrix
TMatrix holds a transformation matrix.
Definition: coordinatealignfilter.h:36
TMatrix::get
double get(int i, int j) const
Definition: coordinatealignfilter.h:51
TMatrix::TMatrix
TMatrix(const TMatrix &other)
Definition: coordinatealignfilter.h:44
TMatrix::TMatrix
TMatrix()
Definition: coordinatealignfilter.h:41
TMatrix::data_
double data_[DIM][DIM]
Definition: coordinatealignfilter.h:63
TMatrix::setMatrix
void setMatrix(const double m[DIM][DIM])
Definition: coordinatealignfilter.h:59
TMatrix::TMatrix
TMatrix(double m[][DIM])
Definition: coordinatealignfilter.h:47
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(TMatrix)
orientationdata.h
Datatypes for different filters.