2 #include "Transformer3D1Point.h"
4 CONSTRUCTOR: Initializes the two points with empty vectors, the angle in 0.
6 Transformer3D1Point::Transformer3D1Point()
8 std::vector<int> empty (3,0);
10 //If the transform already exists, we delete it before we create a new transform
11 //and set the matrix with the identity matrix
12 _transform= vtkTransform::New();
13 _matrix = vtkMatrix4x4::New();
15 _transform->SetMatrix(_matrix);
21 Transformer3D1Point::~Transformer3D1Point()
23 //We delete the existing transform
24 if (_transform != NULL ) { _transform->Delete(); }
25 if (_matrix != NULL ) { _matrix->Delete(); }
31 void Transformer3D1Point::SetTransform(vtkTransform *transform)
39 void Transformer3D1Point::SetCenterPoint(std::vector<int> point)
47 void Transformer3D1Point::SetAngleX(double angle)
55 void Transformer3D1Point::SetAngleY(double angle)
63 void Transformer3D1Point::SetAngleZ(double angle)
71 void Transformer3D1Point::SetScaleX(double scaleX)
79 void Transformer3D1Point::SetScaleY(double scaleY)
87 void Transformer3D1Point::SetScaleZ(double scaleZ)
93 GETS THE RESULTANT TRANSFORM
95 vtkTransform *Transformer3D1Point::GetResult()
101 MAKES THE TRANSFORMATIONS
103 void Transformer3D1Point::Run()
105 //Clears any old transformations in the pipeline
106 _transform->Identity();
108 //Make all transformations in post multiply mode
109 _transform->PostMultiply();
111 //Centers the image before applying the transformation
112 _transform->Translate(-_centerPoint[0], -_centerPoint[1], -_centerPoint[2]);
115 _transform->RotateWXYZ(_angleY, 0, 1, 0);
116 _transform->RotateWXYZ(_angleX, 1, 0, 0);
117 _transform->RotateWXYZ(_angleZ, 0, 0, 1);
118 _transform->Scale(_scaleX, _scaleY,_scaleZ);
120 //Returns the inverse of the transformation (NTU: Have no idea why we have to do this for the image to appear properly)
121 _transform->Inverse();
122 _transform->Update();