CTL  0.6.1
Computed Tomography Library
matrix_utils.h
1 #ifndef CTL_MATRIX_UTILS_H
2 #define CTL_MATRIX_UTILS_H
3 
4 #include "matrix.h"
5 #include <QVariant>
6 #include <QVector>
7 
8 namespace CTL {
9 
10 typedef mat::Matrix<3, 3> Matrix3x3;
11 typedef mat::Matrix<3, 1> Vector3x1;
12 
13 namespace mat {
14 
15 // conversion of the Matrix content to a QVector
16 template <uint Rows, uint Cols>
17 QVector<double> toQVector(const Matrix<Rows, Cols>& matrix);
18 
19 // rotation matrix and related
20 Matrix3x3 rotationMatrix(double angle, Qt::Axis axis);
21 Matrix3x3 rotationMatrix(double angle, const Vector3x1& axis);
22 Matrix3x3 rotationMatrix(const Vector3x1& axis) noexcept;
23 Vector3x1 rotationAxis(const Matrix3x3& rotMat, bool lengthEqualsAngle = true);
24 double rotationAngle(const Matrix3x3& rotMat);
25 
26 // # CTL helper struct
27 struct Location
28 {
29  Vector3x1 position = Vector3x1(0.0);
30  Matrix3x3 rotation = mat::eye<3>();
31 
32  Location() = default;
33  Location(const Vector3x1& pos, const Matrix3x3& rot);
34  Location(const Matrix3x3& rot, const Vector3x1& pos);
35  explicit Location(const Vector3x1& pos);
36  explicit Location(const Matrix3x3& rot);
37 
38  QVariant toVariant() const;
39  void fromVariant(const QVariant& variant);
40 };
41 
42 } // namespace mat
43 } // namespace CTL
44 
45 #include "matrix_utils.tpp"
46 
47 #endif // CTL_MATRIX_UTILS_H
Definition: matrix_utils.h:27