[vtkusers] Cell data in a vtkPolyData object

Charles Boivin Charles.Boivin at rwdiwest.com
Thu Aug 26 17:32:51 EDT 2004


Hello everyone,

Well, I am still working on my custom reader, and thanks to everyone
here, a lot of progress has been made. I am able to load my geometry and
connectivity properly using various types of cells (vertices, lines, and
polygons), and that works pretty well. I have also been able to load any
kind of point data (i.e. combinations of scalars, vectors, etc..)
successfully.

I then turned my attention to cell data. Cells are stored in the
vtkPolyData class using different containers for vertices, lines and
polygons, i.e. there is a separate vtkCellArray array for vertices,
lines, and polygons. Those are set in vtkPolyData using
vtkPolyData::SetVertices(), SetLines() and SetPolys(). (I don't mean to
lecture anyone here, but I figured I would explain how I understand
things; that way it would be easy for you to point out a flaw in my
reasoning). 

I store my cell data in a vtkDoubleArray, and later set the cell data
to it using a call to
vtkPolyData::GetCellData()->AddArray(myCellDataArray). This is pretty
much the same process that I (successfully) use for node data. However,
things to do not look right for cell data if I have different types of
cells (i.e. verts, lines, and polys) in my geometry. 

When I set the data, I need to specify an index to the cell, and then
the data. How do I know what the index of the different cells are when
stored in vtkPolyData if they are not all in the same container? I know
the vtkCellArray::InsertCell() function returns an index to its
position, but, for example, the vertices array does not know about the
line array, and vice-versa. When I then have only *one* array for my
data, how do I arrange it properly so that it matches the cells?

I hope I made myself clear... this is a bit puzzling to me! 

Thank you in advance,

Charles Boivin



More information about the vtkusers mailing list