[vtkusers] Use landmarks on PolyData
David Doria
daviddoria at gmail.com
Fri May 3 11:27:47 EDT 2013
On Fri, May 3, 2013 at 11:10 AM, Massinissa Bandou <
Massinissa.Bandou at usherbrooke.ca> wrote:
> Hi everyone!!
>
> I'm wondering if someone could help me with this code? I want to add a
> visible landmarks on a polydata according to mouse position. I found a good
> example *http://www.vtk.org/pipermail/vtkusers/2004-February/071696.html*
> but I want a new landmark(sphere) appears every time when I press ''p''.
>
> I'm not familiar with callback functions and I have tried many ways to add
> a
> new sphere at the picked points but it seems not working. I would
> appreciate
> if someone could refer me to some documentation about callback functions
>
Your code is just changing the position of a single sphere (SetPosition) in
the callback. You need to create a new actor inside the callback:
vtkActor *sphereActor = vtkActor::New();
sphereActor->SetMapper(sphereMapper);
sphereActor->GetProperty()->SetColor(1,0,0);
sphereActor->PickableOff();
renderer->AddActor(sphereActor);
This will require you to give the callback a pointer to the Renderer so you
can call AddActor.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130503/054c1d4d/attachment.htm>
More information about the vtkusers
mailing list