[vtkusers] Question about the meaning of the text file generated by vtkPolyDataWriter, which is for reading a vtkPolyData
HayamiSanjuro
sanjurohayami at hotmail.com
Sun Aug 10 05:34:55 EDT 2008
Hi guys,
I found I have a difficult to understand the text file generated by vtkPolyDataWriter.
The situation is I create a set of following 5 points to construct a ploygon:
vtkPoints *points = vtkPoints::New();
points->InsertPoint(0,0,0,0);
points->InsertPoint(1,2,2,0);
points->InsertPoint(2,4,2,0);
points->InsertPoint(3,6,0,0);
points->InsertPoint(4,3,1,0);
vtkCellArray *polys = vtkCellArray::New();
polys->InsertNextCell(5);
polys->InsertCellPoint(4);
polys->InsertCellPoint(3);
polys->InsertCellPoint(2);
polys->InsertCellPoint(1);
polys->InsertCellPoint(0);
Then, i performed the constrained Delaunay triangulation:
vtkPolyData *polyData = vtkPolyData::New();
polyData->SetPoints(points);
polyData->SetPolys(polys);
vtkDelaunay2D *del = vtkDelaunay2D::New();
del->SetInput(polyData);
del->SetSource(polyData);
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
vtkPolyData * outputPolyData = del->GetOutput();
outputPolyData->Update();
vtkPolyDataWriter *writer = vtkPolyDataWriter::New();
writer->SetInput(outputPolyData);
writer->SetFileName("test.txt");
writer->Write();
The result text file is pretty confusing me:
----text.txt----------------------------------------
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 5 float
0 0 0 2 2 0 4 2 0
6 0 0 3 1 0
POLYGONS 3 12
3 4 2 1
3 4 3 2
3 4 1 0
CELL_DATA 3
POINT_DATA 5
------------------------------------------------------
I can see the "POINTS 5 float" section is state the coordinate of 5 points
but the "POLYGONS 3 12" really confused me. Can any1 explain it for me PLZ!!!!!!!!!
Cheers!
YANG Rong
20 Orton,
Glenfield, AKL,
New Zealand
Cell: +64 21 2355108
Home phone: 09 4434960
_________________________________________________________________
MSN 中文网,最新时尚生活资讯,白领聚集门户。
http://cn.msn.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080810/92b7a54e/attachment.htm>
More information about the vtkusers
mailing list