Hi Aashish,this week I've written a new Interactor style to use a 3dconnexion SpaceNavigator in Paraview with vrpn server. Translational motion works fine in parallel and orthogonal projection but rotation is not finished yet.
Two things I did not solve:- the first time a new Interaction is created, PV crashes when the point vtkVRQueue:Enqueue, this->Mutex->Lock() is reached (called by newAnalogValue), if I use "Restore State" it works -> I think anything has to be initialized but did not find it. - rotation of the scene is confusing to me. I have as input 3 analog values (roll/pitch/yaw) between -1 and +1. I tried to map this to CameraViewUp with euler-zyx-Transformation. But it does not work as expected.
Question at all: what would be the best way to map a scalar value to the rotation of a scene/view ? What does the buttons roll/pitch/yaw in the camera-property-menue ? I think I would need exact the same functions behind theses 3 buttons.
Here is the code-snippet I tried for that:
vtkSMPropertyHelper( proxy, "CameraViewUp" ).Get( rot, 3 ); //rotation
phi= data.data.analog.channel[3]*M_PI/180;
theta= data.data.analog.channel[4]*M_PI/180;
psi= data.data.analog.channel[5]*M_PI/180;
double x=rot[0];
double y=rot[1];
double z=rot[2];
double tt[3][3];
tt[0][0]=cos(theta)*cos(psi);
tt[0][1]=-cos(phi)*sin(psi)+sin(phi)*sin(theta)*cos(psi);
tt[0][2]=sin(phi)*sin(psi)+cos(phi)*sin(theta)*cos(psi);
tt[1][0]=cos(theta)*sin(psi);
tt[1][1]=cos(phi)*cos(psi)+sin(phi)*sin(theta)*cos(psi);
tt[1][2]=-sin(phi)*cos(psi)+cos(phi)*sin(theta)*sin(psi);
tt[2][0]=-sin(theta);
tt[2][1]=sin(phi)*cos(theta);
tt[2][2]=cos(phi)*cos(theta);
rot[0] = x*tt[0][0]+y*tt[0][1]+z*tt[0][2];
rot[1] = x*tt[1][0]+y*tt[1][1]+z*tt[1][2];
rot[2] = x*tt[2][0]+y*tt[2][1]+z*tt[2][2];
vtkSMPropertyHelper( proxy, "CameraViewUp" ).Set( rot, 3 );
I attached the sourcecode, maybe someone has time over christmas to have
a look.
Have a nice Christmas time & happy new year, Christian Am 30.11.2012 03:42, schrieb Aashish Chaudhary:
Hi Christian,Are you still interested? if yes, let me know and I can provide you more help.Thanks,On Tue, Nov 6, 2012 at 11:34 AM, Christian Richter <[email protected] <mailto:[email protected]>> wrote:ell me how to write a styl -- | Aashish Chaudhary | R&D Engineer | Kitware Inc. | www.kitware.com <http://www.kitware.com>
vtkVRControlChangeCameraPositionStyle.tar.gz
Description: GNU Zip compressed data
_______________________________________________ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
