[vtkusers] A question

Charl P. Botha c.p.botha at ewi.tudelft.nl
Thu Mar 11 12:39:45 EST 2004


On Thu, 2004-03-11 at 18:25, Luke Hua wrote:
> You don't need to store an array of IDs. You just need to have an
> integer and incrementally increase the integer and assaign it to
> individual actors.  You can use ID to retrieve the actors by ID from
> actor collection of the render window.
>  
> I think it is better than actor array, which you have to assaign an
> integer when you don't know how many actors will actually be there.

Try an STL vector.  It grows on demand.

Alternatively, you could write code that traverses the collection and
retrieves the N'th actor.

>  
>                                                                            Luke
>  
> "Charl P. Botha" <c.p.botha at ewi.tudelft.nl> wrote:
>         Luke Hua wrote:
>         > My application dynamically create and delete actors in my
>         scene. If I 
>         > use pointer to track actors, I have to use large actor array
>         to store 
>         > data. I hate use array to store and delete data. It's a
>         pain.
>         > 
>         > Luke 
>         
>         What's the difference between storing an array of actor
>         pointers (on 
>         x86-32, 4 bytes each) and storing an array of IDs (on x86-32,
>         int IDs 
>         are 4 bytes each)? I still don't see your problem.
>         
>         > 
>         > */"Charl P. Botha" /* wrote:
>         > 
>         > On Mon, 2004-03-08 at 21:19, Luke Hua wrote:
>         > > Is there any way to retrieve actor by ID or properties? My
>         renderer
>         > > has various kind of actors and I need to delete and add
>         them
>         > > dynamically. It's very difficult to track the position of
>         actors
>         > using
>         > > Initialtraversal()! .
>         > >
>         > > There is no return values for addActor(). Could vtk make
>         some changes
>         > > so that the addActor() can return a ID for each actor
>         therefore
>         > easier
>         > > to retrieve actors?
>         > >
>         > > Or there is any other way to retrieve actors?
>         > 
>         > Why do you need an ID? Why can't you just keep track of the
>         pointers
>         > yourself?
>         > 
>         > actor = vtkActor::New();
>         > doStuffWithActor(actor);
>         > renderer->AddActor(actor);
>         > .
>         > .
>         > .
>         > // sometime later, in a galaxy far far away
>         > renderer->RemoveActor(actor);
>         > 
>         > 
>         > -- 
>         > charl p. botha http://cpbotha.net/
>         http://visualisation.tudelft.nl/
>         > 
>         >
>         ------------------------------------------------------------------------
>         > Do you Yahoo!?
>         > Yahoo! Search - Find what you抮e looking for faster. 
>         > 
>         
>         
>         -- 
>         cha! rl p. botha http://cpbotha.net/
>         http://visualisation.tudelft.nl/
>         
>         _______________________________________________
>         This is the private VTK discussion list.
>         Please keep messages on-topic. Check the FAQ at: 
>         Follow this link to subscribe/unsubscribe:
>         http://www.vtk.org/mailman/listinfo/vtkusers
> 
> ______________________________________________________________________
> Do you Yahoo!?
> Yahoo! Search - Find what you?re looking for faster.
-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/





More information about the vtkusers mailing list