<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>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:</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>this->InsertLocation = 0;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>this->TraversalLocation = 0;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>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:</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>this->InsertLocation = ca->InsertLocation;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>this->TraversalLocation = ca->TraversalLocation;</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>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. </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>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. </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks,</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Chris</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>--<br>
Christopher R. Volpe,
Ph.D.                                                       <br>
Senior Scientist                                                           Email:
<a href="mailto:cvolpe@ara.com">cvolpe@ara.com</a><br>
Applied Research Associates, Inc.                                Voice:
</span></font><font size=2><span style='font-size:10.0pt'>919-582-3380<br>
  8540 Colonnade Center Dr., Ste 301</span></font><font size=2><span
style='font-size:10.0pt'>                                   Fax:
919-878-3672<br>
</span></font><font size=2><span style='font-size:10.0pt'>Raleigh</span></font><font
 size=2><span style='font-size:10.0pt'>, </span></font><font size=2><span
  style='font-size:10.0pt'>NC</span></font><font size=2><span style='font-size:
 10.0pt'> </span></font><font size=2><span style='font-size:10.0pt'>27615</span></font><font
size=2><span style='font-size:10.0pt'>                                                              Web:
<a href="http://www.ara.com/">www.ara.com</a></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'><br>
<br>
 </span></font> </p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'> </span></font></p>

</div>

</body>

</html>