[vtkusers] Cell data in a vtkPolyData object

Sander Niemeijer niemeijer at science-and-technology.nl
Fri Aug 27 06:39:35 EDT 2004


Hi Charles,

It's no wonder that it's puzzling you. The fact is that there is 
something very wrong with the design of the vtkPolyData class.

If you use a vtkPolyData object to store only one type of cells (i.e. 
only vertices, or only lines, etc.) then everything goes well. But once 
you start to mix different types of cells in a vtkPolyData object you 
will get into all kinds of trouble.

See for instance my bug report:
http://www.vtk.org/Bug/bug.php?op=show&bugid=564&pos=0

And the e-mail I send to the list about this:
http://public.kitware.com/pipermail/vtkusers/2004-January/071326.html

The only advice I can give you is to use a different vtkPolyData object 
for each cell type you have.

Best regards,
Sander

On donderdag, aug 26, 2004, at 23:32 Europe/Amsterdam, Charles Boivin 
wrote:

> 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
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list