Commit 89677509 authored by saubatn's avatar saubatn
Browse files

FIXED For any rotation on frames, given 3 angles around X, Y and Z, perform 3...

FIXED For any rotation on frames, given 3 angles around X, Y and Z, perform 3 rotations in this specific order : Z, X, Y.
This allows the vtkTransform::GetOrientation() method to retrieve the correct angles around the X, Y and Z axes.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@2167 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 62c16492
......@@ -69,7 +69,7 @@ void Frame::initAttributes() {
this->transformParentToMe = vtkSmartPointer<vtkTransform>::New();
this->transformParentToMe->Identity();
this->transformWorldToMe = vtkSmartPointer<vtkTransform>::New();
this->transformWorldToMe->Identity();
this->transformWorldToMe->PostMultiply();
......@@ -272,12 +272,11 @@ void Frame::setTransformTranslation(double x, double y, double z) {
double * initialRotation = transformParentToMe->GetOrientation();
transformParentToMe->Identity();
transformParentToMe->RotateX(initialRotation[0]);
transformParentToMe->RotateY(initialRotation[1]);
transformParentToMe->RotateZ(initialRotation[2]);
transformParentToMe->RotateZ(initialRotation[2]); // we need to keep the rotations in this Z, X, Y order
transformParentToMe->RotateX(initialRotation[0]); // this allows the vtkTransform::GetOrientation() method
transformParentToMe->RotateY(initialRotation[1]); // to get back the correct angles.
transformParentToMe->Update();
transformParentToMe->Translate(x, y, z);
transformParentToMe->Update();
transformWorldToMe->Update();
representationTransformFilter->Update();
......@@ -288,12 +287,11 @@ void Frame::setTransformRotation(double aroundX, double aroundY, double aroundZ)
double * initialTranslation = transformParentToMe->GetPosition();
transformParentToMe->Identity();
transformParentToMe->RotateX(aroundX);
transformParentToMe->RotateY(aroundY);
transformParentToMe->RotateZ(aroundZ);
transformParentToMe->RotateZ(aroundZ); // we need to keep the rotations in this Z, X, Y order
transformParentToMe->RotateX(aroundX); // this allows the vtkTransform::GetOrientation() method
transformParentToMe->RotateY(aroundY); // to get back the correct angles.
transformParentToMe->Update();
transformParentToMe->Translate(initialTranslation[0], initialTranslation[1], initialTranslation[2]);
transformParentToMe->Update();
transformWorldToMe->Update();
representationTransformFilter->Update();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment