[vtkusers] Cell data in a vtkPolyData object

Sander Niemeijer niemeijer at science-and-technology.nl
Fri Aug 27 08:08:46 EDT 2004


Hi John,

The values of 'cell' are 0, 1, 2. So using 'index++' doesn't change a 
thing.

Best regards,
Sander

On vrijdag, aug 27, 2004, at 14:02 Europe/Amsterdam, John Biddiscombe 
wrote:

> Aha, well you must simply ignore the cell id
>
> what you've done is this...
>
>> cell = polydata.InsertNextCell(VTK_LINE, ids)
>> # line 1 should get the second color (green)
>> colors.InsertTuple1(cell, 0.0)
> ...
>> cell = polydata.InsertNextCell(VTK_POLYGON, ids)
>> # poly 1 should get the first color (red)
>> colors.InsertTuple1(cell, 1.0)
> ...
>> cell = polydata.InsertNextCell(VTK_POLYGON, ids)
>> # poly 2 should get the third color (blue)
>> colors.InsertTuple1(cell, 2.0)
>
> So the first line is ID 0, then the second and tird are ID 0,1 : 
> clearly
> wrong
> just do this
> vtkIdType index = 0;
>
>> cell = polydata.InsertNextCell(VTK_LINE, ids)
>> # line 1 should get the second color (green)
>> colors.InsertTuple1(index++, 0.0)
> ...
>> cell = polydata.InsertNextCell(VTK_POLYGON, ids)
>> # poly 1 should get the first color (red)
>> colors.InsertTuple1(index++, 1.0)
> ...
>> cell = polydata.InsertNextCell(VTK_POLYGON, ids)
>> # poly 2 should get the third color (blue)
>> colors.InsertTuple1(index++, 2.0)
>
> index++ instead of cell, now you get 0,1,2 : who cares what the ID's 
> in each
> cell araay are. they're irrelevant for your needs
>
> JB
>
>




More information about the vtkusers mailing list