[vtkusers] vtkCellPicker: Check for a particular actor?

DVigneault davis.vigneault at gmail.com
Wed Mar 4 10:29:36 EST 2015


All--

Starting with the the MoveAGlyph example [1], I've added additional actors
to the scene.  However, there is nothing to stop me from picking another
actor, which leads to either unintended behavior or an out of bounds error. 
Here is the part of the code that checks the ID:

void OnMiddleButtonDown()
    {
      // Forward events
      vtkInteractorStyleTrackballActor::OnMiddleButtonDown();
      this->MoveActor->VisibilityOn();
      if(static_cast<vtkCellPicker*>(this->InteractionPicker)->GetPointId()
>= 0)

I see that vtkCellPicker can return a collection of actors intercepted by
the ray (GetProp3Ds) and that vtkProp3DCollection can check whether an actor
is present (IsItemPresent).  I tried adding an "intended actor property,"
setting the actor in the body, and then checking whether the actor was
present...

vtkIdType candidateID =
static_cast<vtkCellPicker*>(this->InteractionPicker)->GetPointId();
vtkProp3DCollection* props =
static_cast<vtkCellPicker*>(this->InteractionPicker)->GetProp3Ds();
static_cast<vtkProp3DCollection*>(props)->IsItemPresent(this->IntendedActor);

...but I then get an "invalid use of incomplete type" error on the last
line.  How can I go about ensuring that I've picked the right actor?

Best, and thanks,

--Davis

[1]  http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/Interaction/MoveAGlyph



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkCellPicker-Check-for-a-particular-actor-tp5730644.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list