[vtkusers] vtkAssembly : restore postion and rotation stored in quaterion ?

Ashika Umanga Umagiliya aumanga at biggjapan.com
Mon Jan 23 22:04:17 EST 2012


hi agerlach ,

did you also interpolate the translation ? if so how did you set the
position accordingly ?
 I used something like ,

 vtkSmartPointer<vtkTransform> transform=vtkSmartPointer<vtkTransform>::New();

 transform->Translate(capuredState.x,capuredState.y,capuredState.z);
 transform->RotateWXYZ(360-vtkMath::DegreesFromRadians(angle),ax,ay,az);
 transform->Translate(-capuredState.x,-capuredState.y,-capuredState.z);

 assembly->SetUserTransform(transform);


x,y,z positions in "capturedState" were assigned using the
assembly->GetCenter() method.

But this way it does not translate properly.Any tips on this?


On 24 January 2012 05:14, agerlach <agerlach at gmail.com> wrote:
> I have a function that converts quaternions to euler axis rotation and our
> math is a little different. I know there are more then one ways to do the
> conversion but I know mine works so using your notation:
>
> double angle = 2. * acos(qw);
> double ax = 1./sin(angle/2.)*qx;
> double ay = 1./sin(angle/2.)*qy;
> double az = 1./sin(angle/2.)*qz;
>
> assembly->RotateWXYZ(360 - vtkMath::DegreesFromRadian(angle), ax, ay, az)
>
> This is from "Aircraft control and simulation" by Stevens
>
> I hope this helps.
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/vtkAssembly-restore-postion-and-rotation-stored-in-quaterion-tp5141577p5169608.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



More information about the vtkusers mailing list