[vtkusers] vtkActor (or vtkVolume) SetPosition after rendering

Colin S from_the_southerlands at hotmail.com
Tue Jul 27 16:11:45 EDT 2010


Hi all,
I had a question regarding the usage of the SetPosition() function of vtkActors.  I am trying to change the location of an actor (actually a vtkVolume) in my scene in response to the movement of marker being tracked by a camera.
Basically, my change location function looks something like this:

vtkSmartPointer<vtkVolume> volume;vtkSmartPointer<vtkWindowToImageFilter> w2if;vtkSmartPointer<vtkRenderWindow> renWin;
 void volumeDat::changeLoc(double pos[3])		//pos[3] is the 3D location of the marker {	    volume->SetPosition(floor(pos[0]),floor(pos[1]),floor(pos[2]))     //change the location of the volume based on the position of the marker
  renWin->Render();
  w2if->SetInput(renWin);  w2if->Update();
  return; }
This will work the first time I call it (ie for the first time it sees the marker), but then whenever it is called again with a different position, the location in the scene does not change.
I have done a bit of checking to see where the problem may be, and found that I am correctly setting the position of the volume, as calling volume->GetPosition() will return the values of pos[3] that were stored via volume->SetPosition(), but the location of the volume in the scene does not change.
If anyone knows more about the workings of SetPosition() with respect to this I would greatly appreciate it.
Thanks,Colin 		 	   		  
_________________________________________________________________
Game on: Challenge friends to great games on Messenger
http://go.microsoft.com/?linkid=9734387
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100727/fda78cf1/attachment.htm>


More information about the vtkusers mailing list