[vtkusers] set radius of sphere inside actor

Luis M Bernardo bernardo at OCF.Berkeley.EDU
Tue Aug 21 17:41:07 EDT 2001


On Tue, 21 Aug 2001, Amy Henderson wrote:

> At 01:56 PM 8/21/2001 -0700, Luis M Bernardo wrote:
>
>
> >Hello,
> >I would like to know whether it is possible to change the radius of a
> >sphere after we put the sphere "inside" the actor. Something like this:
>
> Yes, it is possible.
>
> >vtkActor actor* = vtkActor::New();
> >vtkPolyDataMapper mapper* = vtkPolyDataMapper::New();
> >actor->SetMapper(mapper);
> >vtkSphereSource sphere* = vtkSphereSource::New();
> >mapper-SetInput(sphere->GetOutput());
> >
> >I thought about starting like this:
> >vtkPolyDataMapper* m = (vtkPolyDataMapper*) actor->GetMapper();
> >vtkPolyData* d = m->GetInput();
> >
> >but I don't knonw what to do next... this boils down to re-construct a
> >vtkSphereSource from its vtkPolyData, I think.
>
> If you haven't called sphere->Delete() yet, you can just call
> sphere->SetRadius(newRadius).  Otherwise, call m->GetInput()->GetSource();
> cast it to a vtkSphereSource; and then call SetRadius on that.
>

The second suggestion does it. I was looking for something like that but
in my search of the man pages I failed to go all the way up the hierarchy
to vtkObject to find the GetSource() method. Thanks, that answers my question.

Luis

> - Amy
>
> >Thanks,
> >Luis
> >
> >
> >
> >
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at:
> ><http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://public.kitware.com/mailman/listinfo/vtkusers
>





More information about the vtkusers mailing list