Fwd: QMouseEvent position

Hi all, I am trying to drag a vertex of a mesh from its position to a new one using the two events: mouse button press and mouse button release. I can detect those two events and the positions of my mouse in the screen at both times. When I click the button close to a vertex, I use the following function in order to get the corresponding point in the coordinate system of my mesh: PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING,_event->pos (), node_idx, target_idx, &hitPoint); But once I move my mouse and release it, I can only get the position of my mouse in the screen. Do you know an easy way to convert the position of the mouse from the screen coordinate to my mesh coordinate? Thank you in advance, Juliette

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, the main Problem is that you might not have a depth value, when you release your mouse. If you click on the object, and drag away from it, you can do another pick action at that new position. If you are on an object, you will get a position that you can use. If no object is there, then what depth value do you want to use? What you could do is you take the viewing ray through that pixel (Pluginfunctions::viewingRay() in latest svn version). And intersect that ray with a plane constucted with viewing direction as normal and your original point as one point on the plane. The resulting point could be your new point in 3D BTW, the latest svn version also contains a new picking function which can refine the picking for triangle meshes and is not restricted by the depth buffer resolution. Best, Jan On 15.04.2015 10:04, Juliette Pera wrote:
Hi all,
I am trying to drag a vertex of a mesh from its position to a new one using the two events: mouse button press and mouse button release.
I can detect those two events and the positions of my mouse in the screen at both times.
When I click the button close to a vertex, I use the following function in order to get the corresponding point in the coordinate system of my mesh: PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING,_event- pos(),node_idx,target_idx,&hitPoint);
But once I move my mouse and release it, I can only get the position of my mouse in the screen.
Do you know an easy way to convert the position of the mouse from the screen coordinate to my mesh coordinate?
Thank you in advance, Juliette
_______________________________________________ Openflipper mailing list Openflipper@lists.rwth-aachen.de http://mailman.rwth-aachen.de/mailman/listinfo/openflipper
- -- Dipl.Inform. Jan Möbius Department of Computer Science VIII Aachen University of Technology (RWTH) Ahornstrasse 55, 52074 Aachen, Germany Phone ++49 (0)241 80-21802 Fax ++49 (0)241 80-22899 mailto:moebius@cs.rwth-aachen.de http://www.rwth-graphics.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlUuPtMACgkQHGdZRK0SjQZqvQCg70HLeReaxaBuA9KodHako78u Y84An26nKHqhKHvyc8GQ6BzHcvMhJVOE =OoJQ -----END PGP SIGNATURE-----
participants (2)
-
Jan Möbius
-
Juliette Pera