]> Creatis software - clitk.git/commitdiff
Debug camera position with translation
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 11 Jan 2017 14:02:14 +0000 (15:02 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 11 Jan 2017 14:02:14 +0000 (15:02 +0100)
Still bug with rotation

vv/vvSlicer.cxx

index 561e6b5c63b98e15aea25629a326a03896e2de99..7cbd504358988426319be2edd432b1579df0456f 100644 (file)
@@ -1230,10 +1230,14 @@ void vvSlicer::UpdateDisplayExtent()
   if (this->Renderer) {
     if (this->InteractorStyle &&
         this->InteractorStyle->GetAutoAdjustCameraClippingRange()) {
-      double positionCamera[3];
+      double positionCamera[3], originTemp[3];
       this->Renderer->GetActiveCamera()->GetPosition(positionCamera);
       this->Renderer->ResetCameraClippingRange();
-      positionCamera[this->SliceOrientation] = mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[this->SliceOrientation]-1;
+      originTemp[0] = mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[0];
+      originTemp[1] = mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[1];
+      originTemp[2] = mImage->GetVTKImages()[mCurrentTSlice]->GetOrigin()[2];
+      mConcatenatedTransform->GetInverse()->TransformPoint(originTemp, originTemp);
+      positionCamera[this->SliceOrientation] = originTemp[this->SliceOrientation]-1;
       this->Renderer->GetActiveCamera()->SetPosition(positionCamera);
     } else {
       vtkCamera *cam = this->Renderer->GetActiveCamera();