[vtkusers] Best way to store multiple vtkActors using C++
David Doria
daviddoria at gmail.com
Wed Jan 7 08:21:56 EST 2015
On Tue, Jan 6, 2015 at 5:51 PM, Student Life <lifestudent37 at gmail.com>
wrote:
> 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?*
>
Yes, that's exactly how it is done in the example I sent.
> 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++?
>
Sure, you can do whatever you want with your pointers (such as store them
in a std::vector, as John pointed out).
> 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?
>
You can set the "transform" (vtkActor::SetTransform) of an actor like this:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/TransformActor
and you can use vtkTransform::SetMatrix to specify a transform matrix
directly:
http://www.vtk.org/doc/nightly/html/classvtkTransform.html
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?*
>
Yes, every actor needs a mapper. I don't believe any transforms are applied
in the mapper, but rather directly to the actor as I mentioned above.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150107/8ba3467c/attachment.html>
More information about the vtkusers
mailing list