[vtkusers] Data Color

Sylvain Jaume sylvain.jaume at kitware.com
Mon Nov 28 08:16:21 EST 2005


Hi Tarak,

You could create an array of unsigned char values (modulo 256) and set 
it to your polydata cell data.

int numCells = polyData->GetNumberOfCells();
vtkUnsignedCharArray *ucharArray = vtkUnsignedCharArray::New();

for (int i=0;i<numCells;i++)
{
ucharArray->InsertNextValue(i%256);
}

polyData->GetCellData()->SetScalars(ucharArray);
ucharArray->Delete();

Cheers,
Sylvain

tarak ben said wrote:

> I 'd like to color each face of my data set with
> a different color to distinguish each part of my
> 3d object (triangulated mesh)
> Can you help me
> thanks
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>



More information about the vtkusers mailing list