[vtk-developers] Bug in vtkCellArray

Chris Volpe cvolpe at ara.com
Tue Aug 12 17:32:04 EDT 2003

I just discovered a bug in vtkCellArray::DeepCopy that turned out to be
responsible for one of my filters not working properly, but the existing
behavior is so visible that I'm concerned it must have been intentional.
The last two lines of vtkCellArray::DeepCopy are:


this->InsertLocation = 0;

this->TraversalLocation = 0;


I have a filter that adds some polygons to an existing polydata, and I
was deep copying the input poly list into a new vtkPolyData object to
perform topological queries and insertion of new linked cells. I had
originally been sloppy and just done a SetPolys with the input poly
list, and although this had the ill effect of modifying the output
polydata of my filter's input, at least my algorithm worked correctly.
When I replaced the input poly list with a deep copy of it, all sorts of
corruption ensued when inserting linked cells. When I changed the above
two lines to:


this->InsertLocation = ca->InsertLocation;

this->TraversalLocation = ca->TraversalLocation;


my problem disappeared. I believe that the key line is the
InsertLocation line, as this controls where new cells are added. It
seems to me that this bug should manifest itself in other places, and I
wonder if anyone has encountered it. Specifically, it should show up in
classes, like vtkPolyDataNormals, that start off by decomposing tri
strips in polydata that contains both polys and tri strips, since in
this case, it will do a deep copy of the input polys (setting
InsertLocation = 0) and then call vtkTriangleStrip::DecomposeStrip which
will add polys at the beginning of the poly array, overwriting whatever
was there. 


So, is there any reason why DeepCopy ought not to do what I believe
should be the correct behavior? If not, I will check in this fix. 





Christopher R. Volpe, Ph.D.

Senior Scientist
Email: cvolpe at ara.com
Applied Research Associates, Inc.                                Voice:
8540 Colonnade Center Dr., Ste 301
Fax: 919-878-3672
Raleigh, NC 27615
Web: www.ara.com <http://www.ara.com/> 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20030812/0888b6b0/attachment.html>

More information about the vtk-developers mailing list