19 #include "mathfunctions.h" |
19 #include "mathfunctions.h" |
20 #include "linetypes/modelobject.h" |
20 #include "linetypes/modelobject.h" |
21 #include "miscallenous.h" |
21 #include "miscallenous.h" |
22 |
22 |
23 |
23 |
24 MathFunctions::MathFunctions(QObject* parent) : |
24 void MathFunctions::rotateVertex(Vertex& vertex, const Vertex& rotationPoint, const Matrix& transformationMatrix) |
25 HierarchyElement(parent) {} |
|
26 |
|
27 |
|
28 void MathFunctions::rotateVertex(Vertex& vertex, const Vertex& rotationPoint, const Matrix& transformationMatrix) const |
|
29 { |
25 { |
30 vertex -= rotationPoint; |
26 vertex -= rotationPoint; |
31 vertex.transform (transformationMatrix, {0, 0, 0}); |
27 vertex.transform (transformationMatrix, {0, 0, 0}); |
32 vertex += rotationPoint; |
28 vertex += rotationPoint; |
33 } |
29 } |
34 |
30 |
35 |
31 |
36 void MathFunctions::rotateObjects(int l, int m, int n, double angle, const QVector<LDObject*>& objects) const |
32 void MathFunctions::rotateObjects(int l, int m, int n, double angle, const QVector<LDObject*>& objects) |
37 { |
33 { |
38 Vertex rotationPoint = getRotationPoint (objects); |
34 Vertex rotationPoint = getRotationPoint (objects); |
39 double cosAngle = cos(angle); |
35 double cosAngle = cos(angle); |
40 double sinAngle = sin(angle); |
36 double sinAngle = sin(angle); |
41 |
37 |