[vtkusers] Best way to store multiple vtkActors using C++

jrpani at louisville.edu jrpani at louisville.edu
Tue Jan 6 18:59:15 EST 2015

It sounds like this example may be of use to you for some of your questions (it was to me).


Once your polydata  are in actors, vtkActor has lots of methods for moving them individually (mostly inherited from vtkProp3D).




From: vtkusers [vtkusers-bounces at vtk.org] on behalf of Student Life [lifestudent37 at gmail.com]
Sent: Tuesday, January 06, 2015 5:51 PM
To: David Doria
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Best way to store multiple vtkActors using C++

Dear David Doria,

Thank you for your response.

I did some research into the vtkAssembly class and found that the method, 'void AddPart (vtkProp3D *)' adds the part. However, it takes a vtkProp3D object as its parameter, but then vtkActor inherits from vtkProp3D. Would I be right in saying that this function would still work, as my objects are all declared as vtkActor and not vtkProp3D?

The only sort of difficulty/concern I am having is storing more than one vtkActor in a vtkRenderer.

So far, I intend on implementing an actor class in C++, and then another class called 'MultipleActors' which takes instances of the actor class and stores it as a linked list. However, I am not sure if this is a wise thing to do. Is there another way/data structure that I could use for storing multiple actors into memory in C++?

Also, in regards to moving the actor independently, I want to make use of matrices? How do I incorporate this into my actor class/VTK?

Finally, I am slightly confused about how the vtkPolyDataMapper works/is incorporated with vtkActors? Does every vtkActor have its own vtkPolyDataMapper? Are rotations and the mathematics behind the vtkPolyDataMapper?


On Tue, Jan 6, 2015 at 1:57 PM, David Doria <daviddoria at gmail.com<mailto:daviddoria at gmail.com>> wrote:
On Tue, Jan 6, 2015 at 5:53 AM, Student Life <lifestudent37 at gmail.com<mailto:lifestudent37 at gmail.com>> wrote:

I basically want to store multiple vtkActors within my render window so that the user can interact with them. I also want to group some vtkActors together

I was thinking of using a linkedlist, to store each vtkActor.

I was also thinking of grouping multiple vtkActors so that they can be interacted with and rotated in unison. I was thinking of doing this using a vtkAssembly, but I'm not too sure.

I am new to VTK and would greatly appreciate some help/advice.

Many thanks

Yes, a vtkAssembly is what you want:


Couple this with the vtkInteractorStyleTrackballActor:


and you should be in business.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150106/5992a95b/attachment.html>

More information about the vtkusers mailing list