The problem is this: there is an implicit ordering to the verts/lines/polys/strips, respectively. So if you insert a bunch of polys, and then a bunch of verts, you will find that your cell ids are scrambled. That is, reading back the polydata you just created you will see the verts appear first, followed by the polys. So the associated attribute data is no longer consistent, etc.<br>
<br>Bad design, I take a lot of the credit :-) But in 1993 when we were writing the book on our own time we had no idea where this crazy VTK thing would end up... <br><br>W<br><br><div><span class="gmail_quote">On 3/18/08, <b class="gmail_sendername">John Platt</b> <<a href="mailto:jcplatt@dsl.pipex.com">jcplatt@dsl.pipex.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">












<div link="blue" vlink="purple" lang="EN-US">

<div><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">Hi,</span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">In Aug 2004 JB wrote on this topic</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">It's not so much that that the design of the polydata is bad, (well, it is</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;">really), but you need to know that all filters operate on cells in order of</span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">verts/lines/polys/strips and so all cell data needs to be stored in this</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;">order. Its extremely annoying and everyone who's used vtk for some length of</span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">time will have been bitten by this one - however, once you know about it,</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;">you always write your filters/importers/etc to operate like this and all is</span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">well.</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">Could someone please give me a hint as to why? It's not obvious to me because vtkPolyData::InsertNextCell() returns a unique cellId which can be used for the cell scalars.</span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;">Thanks for any help.</span></font></pre><pre><font face="Courier New" size="2"><span style="font-size: 10pt;"> </span></font></pre>
<pre><font face="Courier New" size="2"><span style="font-size: 10pt;">John.</span></font></pre>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

</div>

</div>


<br>_______________________________________________<br>
vtk-developers mailing list<br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:vtk-developers@vtk.org">vtk-developers@vtk.org</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>
<a href="http://www.kitware.com">http://www.kitware.com</a><br>518-371-3971 (phone and fax)