2 #include "Transformer.h"
3 #include "vtkMatrix4x4.h"
6 CONSTRUCTOR: Initializes the two points with empty vectors, the angle in 0.
8 Transformer::Transformer()
10 std::vector<int> empty (3,0);
15 //If the transform already exists, we delete it before we create a new transform
16 //and set the matrix with the identity matrix
17 _transform= vtkTransform::New();
18 _matrix = vtkMatrix4x4::New();
20 _transform->SetMatrix(_matrix);
26 Transformer::~Transformer()
28 //We delete the existing transform
29 if (_transform != NULL ) { _transform->Delete(); }
30 if (_matrix != NULL ) { _matrix->Delete(); }
36 void Transformer::SetTransform(vtkTransform *transform)
44 void Transformer::SetCenterPoint(std::vector<int> point)
52 void Transformer::SetAngle(double angle)
60 void Transformer::SetScaleX(double scaleX)
68 void Transformer::SetScaleY(double scaleY)
76 void Transformer::SetScaleZ(double scaleZ)
84 GETS THE RESULTANT TRANSFORM
86 vtkTransform *Transformer::GetResult()
92 MAKES THE TRANSFORMATIONS
94 void Transformer::Run()
96 _transform->Identity();
97 _transform->Translate(_centerPoint[0], _centerPoint[1], _centerPoint[2]);
99 _transform->RotateWXYZ(_angle, 0, 0, 1);
100 _transform->Scale(_scaleX, _scaleY,_scaleZ);
102 _transform->Update();