<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
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:blue;
text-decoration:underline;}
p
{margin-right:0cm;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
pre
{margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle20
{font-family:Arial;
color:navy;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi Will,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>It seems that the implicit ordering is
enforced by BuildCells(). If you look at a filter like vtkDataSetSurfaceFilter::UnstructuredGridExecute(),
it takes care to make the calls</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> newVerts->InsertNextCell()</span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>newLines->InsertNextCell()</span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>newPolys->InsertNextCell()</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>in the correct order. Setting the verts/lines/polys
separately leaves the internal cell array (vtkPolyData::Cells) null. At some
stage in the future, the null cell array will attract a call to BuildCells().
All is well with any cell data because the filter has constructed the ouput polydata
in the implicitly assumed order.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>But suppose a new filter builds it’s
output polydata using vtkPolyData::InsertNextCell() instead. The internal cell
array (vtkPolyData::Cells) is updated as different cells are inserted irrespective
of the order. Since the internal cell array is now not null, BuildCells() will
not be called and the cell data ordering is preserved.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>It is this last suggestion that I would
like clarification on. I must stress that I have based all the above on code
inspection only.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for your time,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>John.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='text-indent:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Will Schroeder
[mailto:will.schroeder@kitware.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>18 March 2008</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>20:07</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> John Platt<br>
<b><span style='font-weight:bold'>Cc:</span></b> vtk Developers<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [vtk-developers]
vtkPolydata and cell data</span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>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</span></font></p>
<div>
<p class=MsoNormal style='margin-left:36.0pt'><span class=gmailquote><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>On </span></font></span><span class=gmailquote>3/18/08</span><span class=gmailquote>, <b><span style='font-weight:
bold'>John Platt</span></b> <<a href="mailto:jcplatt@dsl.pipex.com">jcplatt@dsl.pipex.com</a>>
wrote:</span></p>
<div link=blue vlink=purple>
<div><pre style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>Hi,</span></font></pre><pre style='margin-left:36.0pt'><font
size=2 face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>In Aug 2004 JB wrote on this topic</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
36.0pt'><font size=2 face="Courier New"><span style='font-size:10.0pt'>It's not so much that that the design of the polydata is bad, (well, it is</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>really), but you need to know that all filters operate on cells in order of</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>verts/lines/polys/strips and so all cell data needs to be stored in this</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>order. Its extremely annoying and everyone who's used vtk for some length of</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>time will have been bitten by this one - however, once you know about it,</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>you always write your filters/importers/etc to operate like this and all is</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>well.</span></font></pre><pre style='margin-left:36.0pt'><font
size=2 face="Courier New"><span style='font-size:10.0pt'> </span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'>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
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
36.0pt'><font size=2 face="Courier New"><span style='font-size:10.0pt'>Thanks for any help.</span></font></pre><pre
style='margin-left:36.0pt'><font size=2 face="Courier New"><span
style='font-size:10.0pt'> </span></font></pre><pre style='margin-left:
36.0pt'><font size=2 face="Courier New"><span style='font-size:10.0pt'>John.</span></font></pre>
<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>
</div>
</div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
36.0pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
vtk-developers mailing list<br>
<a href="mailto:vtk-developers@vtk.org"
onclick="return top.js.OpenExtLink(window,event,this)">vtk-developers@vtk.org</a><br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank"
onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtk-developers</a></span></font></p>
</div>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br clear=all>
<br>
-- <br>
William J. Schroeder, PhD<br>
Kitware, Inc.<br>
28 Corporate Drive<br>
</span></font>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) </p>
</div>
</body>
</html>