[vtkusers] Casting vtkDataArray to vtkUnsignedCharArray

David Doria daviddoria at gmail.com
Sun Feb 15 16:48:53 EST 2009


Currently I'm doing this:
vtkSmartPointer<vtkDataArray> ColorsData =
polydata->GetPointData()->GetArray("Colors");
vtkSmartPointer<vtkUnsignedCharArray> ColorsChar = dynamic_cast<
vtkUnsignedCharArray * >(ColorsData);

It seems like this should be able to be done without the dynamic_cast,
but I can't get it to work. Any suggestions?

Also, is there a more standard way to store colors associated with
points? If I save them to this "Colors" array, if I gave the file to
someone they'd have to write a writer to extract the data from
"Colors". It seems like colors would be a very standard thing to want
to store/extract?

Thanks,

David



More information about the vtkusers mailing list