[vtkusers] How to get a reference to a picked actor

John Eke tonee47 at yahoo.com
Fri Aug 15 09:20:17 EDT 2008


It works! 

Thanks



----- Original Message ----
From: Sercani <sercanimailgroups at gmail.com>
To: John Eke <tonee47 at yahoo.com>; vtkusers at vtk.org
Sent: Friday, August 15, 2008 4:52:11 AM
Subject: RE: [vtkusers] How to get a reference to a picked actor

 
Hi John;
Check out this code:
vtkPropPicker *picker=vtkPropPicker::New();
picker->Pick(point.x,
point.y,0.0,renderer); /*this point coordinates must be in display
coordinates!!!renderer is your renderer that contains these actors..*/
picker->GetActor();
//this is your pointer to picked actor…You can also write this:  vtkActor
*actor=vtkActor::New();actor=picker->GetActor();
 
I recommend using vtkPropPicker instead of vtkPicker because
PropPicker is extremely fast…
 
From:vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of John
Eke
Sent: Thursday, August 14, 2008 7:28 PM
To: vtkusers at vtk.org
Subject: [vtkusers] How to get a reference to a picked actor
 
Hi,

I have a bit of code where I create a pointer to vtkActor, then add it to a
Renderer. After that I set the pointer to NULL so I have no reference to it
anymore. Say I have several of such actors within the same Renderer, how can I
perform a pick, and get back a reference to the picked actor?

All this is being done within my subclass of vtkInteractorStyle. OnMouseMove, I
draw an actor, and add it to the renderer. OnLeftButtonDown I perform a pick on
any of the actors drawn. If someone could please point me in the right
direction, I will be very greatful. I just need to know how to get a pointer to
an actor once a pick is performed.

Thanks


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


More information about the vtkusers mailing list