[vtkusers] Picking and moving a vertex

Henrik Westerberg henrik.westerberg at crg.es
Thu Jun 14 03:51:34 EDT 2007



Hi Meisam, vtkusers,

I don´t know how to get the position of the mouse in 3D either, but if each
vertex is being represented by a vtkActor then you could try calling GetCenter()
on the picked actor. Which can give you the position of objects in 3D space.

hth,

Henrik

-----Original Message-----
From: vtkusers-bounces+henrik.westerberg=crg.es at vtk.org on behalf of Meisam Aliroteh
Sent: Wed 6/13/2007 9:20 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Picking and moving a vertex
 
Hi,

I have a polydata and used a sphere source to render the polydata in
point-cloud mode (i.e only vertices are rendered, and I use spheres to show
these vertices). I want the user to be able to click on any vertex (shpere)
and move it in the 3D space (well actually it would be a motion restricted
to the current view plane). I used vtkCellPicker and know how to figure out
which vertex is picked when the user clicks on it. What I don't know is how
to figure out the motion vector when the user clicks and drags a sphere ? I
can get the old and new mouse positions from the interactor but these are 2D
coordinates.

I guess what I need is the 3D coordinates of the previous and current mouse
positions, so that when I subtract these 3D coordiantes I get a motion
vector and then I can move the picked vertex by adding this motion vector to
it. The problem is I don't know how to get the 3D coordinate of the mouse
pointer using VTK !!!

Any ideas?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070614/b0ac295e/attachment.htm>


More information about the vtkusers mailing list