[vtkusers] Camera movement from button click

Dženan Zukić dzenanz at gmail.com
Mon Nov 7 08:36:07 EST 2011


Maybe just accessing camera (cam in the example code) and calling
Azimuth()will do what you want.

2011/11/7 Dženan Zukić <dzenanz at gmail.com>

> vis is QVTK control. You need to do something maybe similar, but the main
> thing you have to calculate differently is eye position (move eye position
> with button clicks).
> void MainWindow::defaultCameraPos()
> {
>     VisualizingImageType::PointType p;
>     unsigned
> xsize=logic->visualizing->GetLargestPossibleRegion().GetSize(0),
>
>  ysize=logic->visualizing->GetLargestPossibleRegion().GetSize(1),
>
>  zsize=logic->visualizing->GetLargestPossibleRegion().GetSize(2);
>     VisualizingImageType::IndexType ind;
>
>     ind[0]=xsize/2; ind[2]=zsize/2;
>     ind[1]=0;
>     logic->visualizing->TransformIndexToPhysicalPoint(ind, p);
>     vec3 top(p[0], p[1], p[2]);
>
>     ind[0]=xsize-1; ind[1]=ysize/2; ind[2]=zsize/2;
>     logic->visualizing->TransformIndexToPhysicalPoint(ind, p);
>     vec3 right(p[0], p[1], p[2]);
>
>     ind[0]=xsize/2; ind[1]=ysize/2; ind[2]=zsize/2;
>     logic->visualizing->TransformIndexToPhysicalPoint(ind, p);
>     vec3 center(p[0], p[1], p[2]);
>
>     vec3 up(top-center), eye((right-center)^up); //view from left
>     vtkCamera
> *cam=vis->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera();
>     cam->SetPosition(eye[0], eye[1], eye[2]);
>     cam->SetViewUp(up[0], up[1], up[2]);
>
> vis->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->ResetCamera();
> }
>
> On Sat, Nov 5, 2011 at 21:46, Claire.Fanny <Claire.Fanny1995 at gmail.com>wrote:
>
>> Hi iam Claire well from subject of this email i know you all better
>> understand what i need to do,
>> what i want when i click on button so camera automatically move in clock
>> wise direction and another button for anti clock wise so please guide me
>> how
>> can i achieve that bit.
>>
>>
>> Regards
>>
>> Claire Francis
>>
>> --
>> View this message in context:
>> http://vtk.1045678.n5.nabble.com/Camera-movement-from-button-click-tp4967441p4967441.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111107/d8ccf5b2/attachment.htm>


More information about the vtkusers mailing list