[vtkusers] vtkTransform concatenation
David Gobbi
dgobbi at imaging.robarts.ca
Thu May 13 13:19:46 EDT 2004
See comments below:
On Thu, 13 May 2004, N.E Mackenzie-Mackay wrote:
> Hey david,
>
> Her eis a follow up question.
>
> Right now I have a method that returns a transformation. What I would
> like to do is concatonate the result with a transformation that already
> exists. e.g.
>
> Say the method that returns the transformation is called "method" and
> a already existing transform is called "t"
>
> ......
> t->concatenate(method(parameters)) //concatenate the retuned
> transformation with 't'
> ....
>
> If I understand vtk garbage collection correctly, to avoid any memory
> leaks I would have to do this instead:
>
> .....
> vtkTransform temp;
> temp = method(parameters);
> t->concatenate(temp);
> temp->Delete();
> .....
>
> Is there a better way to do what I am doing?
Nope, there is no better way that I'm aware of. If the method creates a
new transform, you have to treat that new transform exactly the same way
you would treat temp = vtkTransform::New().
- David
> Thanks again for your help :)
> Neilson
>
> On May 12, 2004, at 6:15 PM, David Gobbi wrote:
>
> > Hi Neilson,
> >
> > VTK's garbage collection takes care of this for you.
> > When you concatenate 'b', the reference count of 'b' is
> > incremented so you can safely call delete on it,
> > it will stick around until 'a' is deleted.
> >
> > To answer your questions:
> >
> > 1. if you delete 'a', then 'b' will only be destroyed if you have
> > already deleted 'b' once before.
> >
> > 2. if you delete 'b', it won't actually be destroyed until after you
> > have deleted 'a' (or until you have called "Identity" on 'a').
> >
> > - David
> >
> > On Wed, 12 May 2004, N.E Mackenzie-Mackay wrote:
> >
> >> Quick question. Say I had two vtkTransform's: 'a' and 'b'
> >>
> >> if I concatenated a with b: a->concatenate(b);
> >>
> >> 1. if I deleted 'a' would this delete 'b'.
> >> 2. if I delete 'b' would this screw up the pipeline for 'a'
> >>
> >> Thanks,
> >> Neilson
> >>
> >> _______________________________________________
> >> 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://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >
>
More information about the vtkusers
mailing list