我想使用可视化工具包来分散绘图点,每个绘图点都有不同的颜色。我已使用此处给出的建议以灰色绘制点,但我无法理解如何为每个点赋予颜色。
多维数据集示例的相关部分是:
vtkPolyData *cube = vtkPolyData::New();
vtkPoints *points = vtkPoints::New();
vtkCellArray *polys = vtkCellArray::New();
vtkFloatArray *scalars = vtkFloatArray::New();
// Load the point, cell, and data attributes.
for (i=0; i<8; i++) points->InsertPoint(i,x[i]);
for (i=0; i<6; i++) polys->InsertNextCell(4,pts[i]);
for (i=0; i<8; i++) scalars->InsertTuple1(i,i);
// We now assign the pieces to the vtkPolyData.
cube->SetPoints(points);
points->Delete();
cube->SetVerts(polys);
polys->Delete();
cube->GetPointData()->SetScalars(scalars);
scalars->Delete();
我怎样才能给每个 Verts 一种颜色?