[vtkusers] vtkTransform concatenation

N.E Mackenzie-Mackay 9nem at qlink.queensu.ca
Thu May 13 12:28:07 EDT 2004


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?

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