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

David Doria daviddoria at gmail.com
Fri Jan 9 08:22:32 EST 2015


>
> 1) Since I intend on using the* 'vtkInteractorStyleTrackballActor' *to
> interact with actors individually, I know that I will need to manually do
> the mathematics to allow the user to interact with the actor. I intend on
> using matrices, however I am not sure how to incorporate it into my class
> structure. At the moment, I have an *Actor* class, which basically stores
> a *vtkActor's* properties such as opacity, lighting and scale. The thing
> is, I am not sure if I should store the functions that the *vtkTransform*
> and *vtkMatrix4x4* offer in the *Actor *class. Should they be part of my
> *Actor* class, or should they be somewhere else? Because, ideally I want
> to apply transformations on each actor, but I am not sure if I should store
> each transformation in the *Actor *class.
>

It is not clear why you are trying to duplicate the VTK class
structure/functionality? It sounds like all you need is to have a contain
of these objects and use their functions (and NOT manually do the
mathematics).


> 2) In terms of data structure for handling multiple *vtkActors* and
> *vtkAssembly's*, I am not sure if I should opt for the *std::vector * data
> structure or use a *linked list*. Ideally, I want the user to load a few
> stl/obj files and then my software to store each stl/obj file into memory.
> I can't really use an array, because it is unknown how many *vtkActors*,
> the user wants on the screen. What is the best sort of way of storing each
> *vtkActor* into memory? As for *vtkAssemblys*, some actors can be grouped
> into parts, so there will definitely be more than one *vtkAssembly* but
> again, I am not sure which data structure to go for. Should I go for a *std::vector
> *or a *linked list?*
>

The container you choose should only matter for the speed of insertions and
removals.


> 3) If I understand *vtkPolyDatas *correctly, they are basically the
> geometry and mesh behind a physical *vtkActor*? Should I have a separate
> class to handle *vtkPolyData*, because at the moment I have the
> *vtkPolyDataMapper* in my Actor class.
>

Again, it's still not clear why you are duplicating the hierarchy.


> 4) What is the difference between *vtkActorCollection* and *vtkAssembly*?
> Ideally, I want to 'group' some *vtkActors*, so that they can be
> interacted with and rotated in unison, but again I am not too sure which
> one to go for. After, you recommended the *vtkAssembly*, I did some
> research into it and it seems to be the more appropriate one, but now the
> *vtkActorCollection* is confusing me.
>

I'm not too sure, but after a quick look it looks like vtkAssembly allows
hierarchy to be encoded, whereas vtkActorCollection is more like your #2
above where it is simply a flat container to store a collection of actors.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150109/6e395063/attachment.html>


More information about the vtkusers mailing list