From: tbaudier Date: Wed, 11 Jan 2017 14:02:14 +0000 (+0100) Subject: Debug camera position with translation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f0879c0e82b03ffce9a9cc41d0c3e4a4ee397365;p=clitk.git Debug camera position with translation Still bug with rotation --- diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 561e6b5..7cbd504 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -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();