src/mathfunctions.cpp

changeset 1198
f7151e4cd90f
parent 1192
317f4ce38f3f
equal deleted inserted replaced
1197:e22cba39230a 1198:f7151e4cd90f
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
81 } 77 }
82 } 78 }
83 } 79 }
84 80
85 81
86 Vertex MathFunctions::getRotationPoint(const QVector<LDObject*>& objs) const 82 Vertex MathFunctions::getRotationPoint(const QVector<LDObject*>& objs)
87 { 83 {
88 switch (RotationPoint (configuration().rotationPointType())) 84 switch (RotationPoint (configuration().rotationPointType()))
89 { 85 {
90 case ObjectOrigin: 86 case ObjectOrigin:
91 { 87 {

mercurial