[vtkusers] Relative Rotation with VTK Transform

Felipe Bordeu felipebordeu at gmail.com
Tue Feb 16 11:55:23 EST 2016


I did the same thing ones on an app (not  a vtk app). You have to control
the orientation using absolute values. You must set the camera position
using the information from your phone(not the camera rotation). You will
not be able to keep the orientations in  sync using incremental rotations.
Instead you know the orientation of your phone and you know where to put
your camera.

Felipe
Hello,

I'm experimenting a little with the gyroscope of my android tablet to rotate
vtk datasets.

For the sake of simplicity let's imagine that both the tablet and the the
vtk coordinate systems are the same.
So when I tilt my tablet, rotating around the x axis, my dataset rotates
around the x axis as well.
However, if I rotate first say 90 degrees around the y axis and then rotate
again around the x axis, the dataset doesn't rotate around the x axis
anymore but rather around the z axis.
Therefore, what I get does not make sense anymore. However I thought that
what I did was supposed to give me relative transformation.

My algorithm is basically this (I simplify the code as I think the logic
matters and the code really doesn't here).

///Retrieve the current matrix of the dataset and set a transform with this
matrix
vtkSmartPointer<vtkTransform> t = vtkTransform::New();
t->SetUserMatrix(actor->GetMatrix());

//I get the quaternion corresponding to the current rotation of the dataset,
let's call it qD.

//I get from a function call the current rotation performed relatively to
the previous one with the gyroscope, let's call it rotation and assume it's
in the right format directly (WXYZ) of a quaternion qR

//I perform
qf = qD.inverse() * qR

//I rotate the user matrix
t->RotateXYZ(qf[0], ...)
/
But this does not work at all and I get the result previously described.

I even tried directly using the RotateWXYZ with both rotations in different
orders and with either Post or Pre multiply but it doesn't seem to change a
thing to set Post or Pre multiply and no matter what order of rotations I
use, I don't get an interesting result.

Would anyone know what's wrong with my thinking here?

Thanks in advance.





--
View this message in context:
http://vtk.1045678.n5.nabble.com/Relative-Rotation-with-VTK-Transform-tp5736566.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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160216/eeaf80ff/attachment.html>


More information about the vtkusers mailing list