-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewLAT.h
71 lines (59 loc) · 2.04 KB
/
ViewLAT.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
#pragma once
#ifndef VIEWLAT_H
#define VIEWLAT_H
#include "View.h"
class ViewLAT : public View {
Q_OBJECT
public:
explicit ViewLAT(QWidget* parent = nullptr){};
void drawPelvisORTailbonePoint(const QPointF& pos,
const Qt::MouseButton& btn) {
drawTailbonePoint(pos, btn);
}
QPointF getTailbonePoint(int pointIdx) {
return gs.tailbonePoint[pointIdx].position;
}
qreal getTailboneAlpha() {
return -atan2(gs.tailbonePoint[0].position.y() -
gs.tailbonePoint[1].position.y(),
gs.tailbonePoint[0].position.x() -
gs.tailbonePoint[1].position.x()) *
180 / M_PI;
}
qreal getTailboneBeta() {
return atan2(gs.tailbonePoint[1].position.y() -
gs.tailbonePoint[2].position.y(),
gs.tailbonePoint[2].position.x() -
gs.tailbonePoint[1].position.x()) *
180 / M_PI;
}
qreal getD1(int spineIdx) {
qreal x1, y1, x2, y2, m, b, x3, y3;
x1 = (gs.spinePoint[scr][spineIdx][0].position.x() +
gs.spinePoint[scr][spineIdx][1].position.x()) /
2;
x2 = (gs.spinePoint[scr][spineIdx][2].position.x() +
gs.spinePoint[scr][spineIdx][3].position.x()) /
2;
y1 = (gs.spinePoint[scr][spineIdx][0].position.y() +
gs.spinePoint[scr][spineIdx][1].position.y()) /
2;
y2 = (gs.spinePoint[scr][spineIdx][2].position.y() +
gs.spinePoint[scr][spineIdx][3].position.y()) /
2;
x3 = gs.spinousProcessPoint[scr][spineIdx].position.x();
y3 = gs.spinousProcessPoint[scr][spineIdx].position.y();
m = abs((y2 - y1) / (x1 - x2));
b = -m * x1 + y1;
return abs(m * x3 - y3 + b) / sqrt(m * m + 1);
}
signals:
public slots:
private:
point* clickRangedTailbonePointOrNull(const QPointF& pos,
int& outCurrentPoint);
void drawTailbonePoint(QPointF pos, const Qt::MouseButton& btn);
void drawTailboneLine();
void removeAllTailboneLine();
};
#endif // VIEWLAT_H