[vtkusers] Passing vtkPolyData to function
David Doria
daviddoria at gmail.com
Sat May 26 06:48:29 EDT 2012
On Sat, May 26, 2012 at 5:04 AM, cel02000 <cel02000 at yahoo.com> wrote:
> Actually I didn't put the whole code. But polyDataInput is made inside the
> function and stores the data read from a file.
I find that most of the time it is not worth figuring out what happens
to the smart pointers. I usually do something like this:
int myfun(vtkPolyData* polyDataOut)
{
vtkSmartPointer<vtkPolyData> polyDataInput =
vtkSmartPointer<vtkPolyData>::New();
// ... generate your input ...
vtkSmartPointer<vtkCleanPolyData> cleanPoly =
tkSmartPointer<vtkCleanPolyData> ::New();
cleanPoly->SetInput( polyDataInput );
cleanPoly->Update();
polyDataOut->DeepCopy(cleanPoly->GetOutput());
return 0;
}
David
More information about the vtkusers
mailing list