<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Aug 10, 2008, at 5:34 AM, HayamiSanjuro wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> Hi guys,<br><br>I found I have a difficult to understand the text file generated by vtkPolyDataWriter.<br><br>The situation is I create a set of following 5 points to construct a ploygon:<br><br>vtkPoints *points = vtkPoints::New();<br>    points->InsertPoint(0,0,0,0);<br>    points->InsertPoint(1,2,2,0);<br>    points->InsertPoint(2,4,2,0);<br>    points->InsertPoint(3,6,0,0);<br>    points->InsertPoint(4,3,1,0);<br>vtkCellArray *polys = vtkCellArray::New();<br>    polys->InsertNextCell(5);<br>    polys->InsertCellPoint(4);<br>    polys->InsertCellPoint(3);<br>    polys->InsertCellPoint(2);<br>    polys->InsertCellPoint(1);<br>    polys->InsertCellPoint(0);<br><br>Then, i performed the constrained Delaunay triangulation:<br>vtkPolyData *polyData = vtkPolyData::New();<br> &amp;nbs p;  polyData->SetPoints(points);<br>    polyData->SetPolys(polys);<br>vtkDelaunay2D *del = vtkDelaunay2D::New();<br>    del->SetInput(polyData);<br>    del->SetSource(polyData);<br><br>At last, I tried to see the result of the triangulation by get the output and write the result polygon to a text file by using vtkPolyDataWriter <br><br>vtkPolyData * outputPolyData = del->GetOutput();<br>    outputPolyData->Update();<br>    vtkPolyDataWriter *writer = vtkPolyDataWriter::New();<br>    writer->SetInput(outputPolyData);<br>    writer->SetFileName("test.txt");<br>    writer->Write();<br><br>The result text file is pretty confusing me:<br>----text.txt----------------------------------------<br># vtk DataFile Version 3.0<br>vtk output<br>ASCII<br>DATASET POLYDATA<br>POINTS 5 float<br>0 0 0 2 2 0 4 2 0 <br>6 0 0 3 1 0 <br>POLYGONS 3  12<br>3 4 2 1 <br>3 4 3 2 <br>3 4 1 0 <br><br>CELL_DATA 3<br>POINT_DATA 5<br>------------------------------------------------------<br>I can see the "POINTS 5 float" section is state the coordinate of 5 points<br>but the "POLYGONS 3 12" really confused me. Can any1 explain it for me PLZ!!!!!!!!!<br><br>Cheers! <br><br><div><font color="#000066"><font face="Verdana, Geneva, Arial, Sans-serif"><font size="2"><u>YANG</u> Rong <br></font><br><br></font></font></div> </blockquote><br></div><div><br></div><div>There are "3" polygons. Each Polygon has 4 points, for a total of "12" points. Each polygon is listed on its own line. The values for each point represents the index into the "points" array. So breaking this down more we have the following Points: (indices are in brackets):</div><div><br></div><div>[0] 0 0 0 </div><div>[1] 2 2 0 </div><div>[2] 4 2 0 <br>[3] 6 0 0 </div><div>[4] 3 1 0 </div><div><br></div><div>And the following polygons:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Lucida Grande" size="3" style="font: 12.0px Lucida Grande">3 4 2 1 </font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Lucida Grande" size="3" style="font: 12.0px Lucida Grande">3 4 3 2 </font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Lucida Grande" size="3" style="font: 12.0px Lucida Grande">3 4 1 0 </font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">So the first polygon has the points whose indices are 3,4,2,1.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Does this help?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Mike</div></div><div><br></div></body></html>