-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAxes.cpp
More file actions
58 lines (51 loc) · 1.6 KB
/
Copy pathAxes.cpp
File metadata and controls
58 lines (51 loc) · 1.6 KB
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
//
// A class to render coordinate systems
//
// ATTENTION: This class is in this form only meant for rendering purposes!
//
// (c) Georg Umlauf, 2021
//
#include "Axes.h"
Axes::Axes(const QVector4D& _origin,
const QMatrix4x4& _rotation)
: rotation(_rotation),
origin (_origin)
{
type = SceneObjectType::ST_AXES;
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(0)));
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(1)));
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(2)));
}
void Axes::affineMap(const QMatrix4x4& M)
{
QMatrix4x4 T = M; T.setColumn(3,E0);
origin = M * origin;
rotation = T * rotation;
axes.clear();
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(0)));
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(1)));
axes.push_back(QVector3D(origin));
axes.push_back(QVector3D(origin + rotation.column(2)));
}
void Axes::draw(const RenderCamera& renderer, const QColor& color, float lineWidth) const
{
QColor c = color;
c.toHsv();
renderer.renderLine(axes[0],axes[1],c,lineWidth);
c.setHsv(c.hue()+120, c.saturation(), c.value());
renderer.renderLine(axes[2],axes[3],c,lineWidth);
c.setHsv(c.hue()+120, c.saturation(), c.value());
renderer.renderLine(axes[4],axes[5],c,lineWidth);
}
//hinzugefuegt
QVector4D Axes::getOrigin() {
return origin;
}
QVector3D Axes::getZ() {
return axes[5] - axes[4];
}