[vtkusers] set radius of sphere inside actor

Amy Henderson amy.henderson at kitware.com
Tue Aug 21 17:01:04 EDT 2001


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.

- 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