<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>RE: [vtkusers] Picking and moving a vertex</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<BR>
<P><FONT SIZE=2>Hi Meisam, vtkusers,<BR>
<BR>
I donīt know how to get the position of the mouse in 3D either, but if each<BR>
vertex is being represented by a vtkActor then you could try calling GetCenter()<BR>
on the picked actor. Which can give you the position of objects in 3D space.<BR>
<BR>
hth,<BR>
<BR>
Henrik<BR>
<BR>
-----Original Message-----<BR>
From: vtkusers-bounces+henrik.westerberg=crg.es@vtk.org on behalf of Meisam Aliroteh<BR>
Sent: Wed 6/13/2007 9:20 PM<BR>
To: vtkusers@vtk.org<BR>
Subject: [vtkusers] Picking and moving a vertex<BR>
<BR>
Hi,<BR>
<BR>
I have a polydata and used a sphere source to render the polydata in<BR>
point-cloud mode (i.e only vertices are rendered, and I use spheres to show<BR>
these vertices). I want the user to be able to click on any vertex (shpere)<BR>
and move it in the 3D space (well actually it would be a motion restricted<BR>
to the current view plane). I used vtkCellPicker and know how to figure out<BR>
which vertex is picked when the user clicks on it. What I don't know is how<BR>
to figure out the motion vector when the user clicks and drags a sphere ? I<BR>
can get the old and new mouse positions from the interactor but these are 2D<BR>
coordinates.<BR>
<BR>
I guess what I need is the 3D coordinates of the previous and current mouse<BR>
positions, so that when I subtract these 3D coordiantes I get a motion<BR>
vector and then I can move the picked vertex by adding this motion vector to<BR>
it. The problem is I don't know how to get the 3D coordinate of the mouse<BR>
pointer using VTK !!!<BR>
<BR>
Any ideas?<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>