[vtkusers] Best practice with vtkAppendPolyData in a loop?
Jeremie Papon
jpapon at gmail.com
Fri Aug 3 20:13:29 EDT 2012
Hey all,
What's the recommended best practice when appending inside of a loop with
vtkAppendPolyData? Searching the archives gives me conflicting information.
The following works for me, but I don't really like it. Is there a
cleaner/better way?
//////////////////////////////////////////
vtkSmartPointer<vtkExtractGeometry> extract_geometry =
vtkSmartPointer<vtkExtractGeometry>::New ();
extract_geometry->SetImplicitFunction (frustum);
vtkSmartPointer<vtkVertexGlyphFilter> glyph_filter =
vtkSmartPointer<vtkVertexGlyphFilter>::New ();
glyph_filter->SetInputConnection (extract_geometry->GetOutputPort ());
vtkSmartPointer<vtkAppendPolyData> append = vtkAppendPolyData::New ();
for (...)
{
...
extract_geometry->SetInput (poly_data);
vtkPolyData* selected = vtkPolyData::New ();
glyph_filter->SetOutput (selected);
glyph_filter->Update ();
selected->SetSource (0);
append->AddInput (selected);
}
append->Update ();
////////////////////////////////////////////////
If append only does a shallow copy, this seems like it should actually be
fairly efficient, right?
It also doesn't leak any memory as far as I can tell.
I just think it's kind of ugly...
Thanks for any help,
Jeremie Papon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120804/a47fc63a/attachment.htm>
More information about the vtkusers
mailing list