[vtkusers] Re: Changing cell data

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Aug 5 10:25:04 EDT 2005


> the pMatLut). However, I also want to be able to associate a double 
> precision scalar with each cell (and subsequently manipulate it). Has 
> anybody any ideas how this can be done?

Hi Jim,

I have a feeling that I don't understand what you need but at a first pass:

vtkPolyData *data = pMaterialMapper->GetInput();

vtkIdType numCells = data->GetNumberOfCells();

vtkDoubleArray *errors = vtkDoubleArray::New();
	errors->SetName("Errors");
	errors->SetNumberOfComponents(1);
	errors->SetNumberOfTuples(numCells);
vtkCellData *cellData = data->GetCellData();
	cellData->AddArray(errors);
	cellData->SetActiveScalars("Errors");


hth

Goodwin
	




More information about the vtkusers mailing list