[vtkusers] Cell data in a vtkPolyData object
John Biddiscombe
jbiddiscombe at skippingmouse.co.uk
Fri Aug 27 08:02:15 EDT 2004
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