My Project
rotation.cpp
Go to the documentation of this file.
1 #include "stdafx.h"
2 #include "../../stdafx.h"
3 #include "rotation.h"
4 
6 {
7 }
8 
10 {
11 }
12 
14 {
15  if (o->isVertex())
16  {
17  *(Vertex*)o = *(Vertex*)o * this->vMatrixRotation;
18  }
19  else
20  {
21  *(Normal*)o = *(Normal*)o * this->nMatrixRotation;
22  }
23 }
24 
26 {
27  if (o->isVertex())
28  {
29  *(Vertex*)o = *(Vertex*)o * this->vMatrixRotation;
30  }
31  else
32  {
33  *(Normal*)o = *(Normal*)o * this->nMatrixRotation;
34  }
35 }
36 
38 {
39  if (o->isVertex())
40  {
41  *(Vertex*)o = *(Vertex*)o * this->vMatrixRotation;
42  }
43  else
44  {
45  *(Normal*)o = *(Normal*)o * this->nMatrixRotation;
46  }
47 }
48 
50 {
51  this->center = center;
52 
53  GMatrix moveToOrigin = matrixMove(-this->center->X, -this->center->Y, -this->center->Z);
54  GMatrix moveBack = matrixMove(this->center->X, this->center->Y, this->center->Z);
55 
56  this->vMatrixRotation = moveToOrigin * rotate * moveBack;
57 
58  this->nMatrixRotation = this->vMatrixRotation;
60  this->nMatrixRotation.inverse();
61 }
62 
64 {
65 }
66 
68 {
69  this->angle = angle;
70  this->rotate = matrixrotationX(this->angle);
71 }
72 
74 {
75 }
76 
78 {
79  this->rotateX(o);
80 }
81 
83 {
84 }
85 
87 {
88  this->angle = angle;
89  this->rotate = matrixrotationY(this->angle);
90 }
91 
93 {
94 }
95 
97 {
98  this->rotateY(o);
99 }
100 
101 
103 {
104 }
105 
107 {
108  this->angle = angle;
109  this->rotate = matrixrotationZ(this->angle);
110 }
111 
113 {
114 }
115 
117 {
118  this->rotateZ(o);
119 }
120 
~RotationX()
Definition: rotation.cpp:73
double X
Definition: vertex.h:90
Define vertex consisting 3 double coordinates.
Definition: vertex.h:24
~Rotation()
Definition: rotation.cpp:9
virtual bool isVertex()
Definition: baseobject.h:39
Define normal (object container for GVector)
Definition: normal.h:24
Base object. Virtual class. No realisation.
Definition: baseobject.h:23
void rotateY(BaseObject *o)
Definition: rotation.cpp:25
GMatrix matrixrotationY(double angle)
virtual void initModification(Vertex *center) override
Definition: rotation.cpp:49
GMatrix rotate
Definition: rotation.h:68
GMatrix matrixrotationZ(double angle)
GMatrix vMatrixRotation
Definition: rotation.h:69
GMatrix nMatrixRotation
Definition: rotation.h:70
virtual void run(BaseObject *o) override
Definition: rotation.cpp:77
virtual void run(BaseObject *o) override
Definition: rotation.cpp:96
double angle
Definition: rotation.h:67
~RotationY()
Definition: rotation.cpp:92
void rotateX(BaseObject *o)
Definition: rotation.cpp:13
void rotateZ(BaseObject *o)
Definition: rotation.cpp:37
GMatrix matrixMove(double X, double Y, double Z)
GMatrix matrixrotationX(double angle)
Vertex * center
Definition: rotation.h:66
bool inverse()
Definition: gmatrix.cpp:96
Define geometric matrix.
Definition: gmatrix.h:24
Rotation()
Definition: rotation.cpp:5
virtual void run(BaseObject *o) override
Definition: rotation.cpp:116
GMatrix transposition()
Definition: gmatrix.cpp:171