64 vtkInformationVector** inputVector,
65 vtkInformationVector* outputVector)
67 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
69 vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
71 vtkSmartPointer<vtkDoubleArray> colors =
72 vtkSmartPointer<vtkDoubleArray>::New();
73 colors->SetNumberOfComponents(1);
74 std::size_t nPoints = input->GetNumberOfPoints();
75 colors->SetNumberOfValues(nPoints);
76 colors->SetName(
"Colors");
79 for (std::size_t i = 0; i < nPoints; i++)
82 input->GetPoint(i, p);
83 colors->SetValue(i, p[2]);
86 vtkInformation* outInfo = outputVector->GetInformationObject(0);
88 vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
89 output->CopyStructure(input);
90 output->GetPointData()->PassData(input->GetPointData());
91 output->GetCellData()->PassData(input->GetCellData());
92 output->GetPointData()->AddArray(colors);
93 output->GetPointData()->SetActiveScalars(
"Colors");