RotationDrag (with nice picture :-))


perhaps someone can give me a hint…

I have programmed a drag listener. Dragging of spatials works perfect. Now I want to implement a drag rotation listener.

The molecule is on my screen. My camera is somewhere in space having quaternion cq. The spatial, a molecule, is somewhere in space having quaternion mq. When I drag, I get a vector v which tells me the change of the spatial translation (as if I would drag the molecule for translation change !!). Now I want to use v to calculate the new mq lets call it nmq. I think it must work somehow in this way.

Transform vector v to camera system.

Transform the new vector to the molecule system.

Apply it somehow.

Set new quaternion for molecule.

If someone can give me a hint, I would be grateful.

Thanks a lot.



This kind of handling is used in jMP, look at