[vtkusers] How to find the vtkSphereSource object

tao sun colddiesun at gmail.com
Fri Nov 22 02:23:17 EST 2013


Hi,


I create a sphere like this:

VTK_CREATE(vtkSphereSource, sphereSource);

    sphereSource->SetCenter(pos[0], pos[1], pos[2]);

    sphereSource->SetRadius(10.0);

     //Create a mapper and actor

    vtkSmartPointer<vtkPolyDataMapper> mapper =

            vtkSmartPointer<vtkPolyDataMapper>::New();

    mapper->SetInputConnection(sphereSource->GetOutputPort());

     vtkSmartPointer<vtkActor> actor =

            vtkSmartPointer<vtkActor>::New();

    actor->SetMapper(mapper);

    actor->GetProperty()->SetColor(0, 0, 1);

     //this->GetInteractor()->GetRenderWindow()->GetRenderers()->GetDefaultRenderer()->AddActor(actor);

    this->m_viewer2->GetRenderer()->AddActor(actor);

    this->m_viewer2->Render();


Later I want to find this sphere in another function and delete it.
How can I do that? I saw vtkPolyDataCollection, is this the right one
I need to get?



Thanks,

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


More information about the vtkusers mailing list