[vtkusers] vtkOBBTree and vtkActor

Sergio Aguirre sergio.aguirre at gmail.com
Mon Mar 21 16:11:42 EDT 2011


Hi everyone

I am trying to have some interaction between a tracked pointer and vtkActors
in a scene.

My actors are simple objects I call like vtkConeSource, vtkPolyDataMapper
and vtkActor.

Basically I am building a line using vtkLineSource and testing if the line
intersects any actors in my scene with vtkOBBTree using the code below.

tBox = vtkOBBTree::New();
iter = vtkCollectionIterator::New();
iter->SetCollection(actrList);
iter->InitTraversal();

int c = 0; // counter to change state
int poked = -1; // actor poked

while ( !iter->IsDoneWithTraversal() )
{
vtkActor* tmp_actr = (vtkActor*) iter->GetCurrentObject();
tmp_actr->GetMapper()->GetInput()->Update(); // update the object
tBox->SetDataSet( tmp_actr->GetMapper()->GetInput() );
tBox->BuildLocator();

if( tBox->IntersectWithLine(lasserP1, lasserP2, NULL, NULL) != 0 )
{
poked = c;
break;
}

iter->GoToNextItem();
c++;
}

However, because the vtkOBBTree tests against vtkDataSet (ie vtkConeSource)
the new (translated or rotated) coordinates are not updated when I test the
intersection again.

As far as I can tell I would need to update the 'center' of the vtkDataSet
downstream from the vtkActor...

I hope anyone can share any suggestions.

Sergio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110321/345adeb6/attachment.htm>


More information about the vtkusers mailing list