-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.h
74 lines (51 loc) · 1.73 KB
/
backend.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef BACKEND_H
#define BACKEND_H
#include <QObject>
#include <QVector>
#include <QVector2D>
#include <QVector3D>
#include <QGenericMatrix>
Q_DECLARE_METATYPE(QVector2D)
Q_DECLARE_METATYPE(QList<QVector2D>)
Q_DECLARE_METATYPE(const double *)
class Backend : public QObject
{
Q_OBJECT
public:
explicit Backend(QObject *parent = nullptr);
enum CubeDimension{
Dim3 = 0,
Dim4
};
Q_ENUM(CubeDimension)
Q_INVOKABLE QVector2D getPoint(const int index){
if(index < m_Tesseract.size())
return m_Tesseract.at(index);
return QVector2D(0,0);
}
Q_INVOKABLE QList<int> getNearest(const int index){return m_nNeighbours.at(index);}
Q_INVOKABLE inline bool is4D(){ return m_Dimension == Dim4;}
signals:
void tesseractChanged();
void newCube(const QVector<QVector3D> &v, const QList<QList<int> > &nn, bool dim3 = true);
public slots:
void updatePoints();
private:
QVector2D matrixToVector2d(const QGenericMatrix<1,3,double> &matrix);
QVector2D matrixToVector2d(const QGenericMatrix<1,4,double> &matrix);
QVector3D matrixToVector3d(const QGenericMatrix<1,3,double> &matrix);
QVector3D matrixToVector3d(const QGenericMatrix<1,4,double> &matrix);
void createCube();
void createVector(const double x, const double y, const double z);
void createVector(const double x, const double y, const double z, const double w);
void createNN();
protected:
QList<QVector2D> m_Tesseract;
QList<QList<int> > m_nNeighbours;
QVector<QGenericMatrix<1,3,double> > m_VectorMatices3d;
QVector<QGenericMatrix<1,4,double> > m_VectorMatices4d;
double angle = 0;
CubeDimension m_Dimension = Dim3;
QVector<quint64> m_Ms;
};
#endif // BACKEND_H