Visualization Toolkit을 사용하여 각기 다른 색상을 갖는 플롯 점을 분산시키고 싶습니다. 주어진 조언을 here을 사용하여 회색 색상으로 점을 그리지 만 각 색상에 색상을 지정하는 방법을 이해하지 못하고 있습니다. 큐브 예VTK를 사용하여 다른 색상의 점을 그립니다.
관련 부분은 다음과 같습니다
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();
가 어떻게 색을 버텍스의 각을 줄 수 있습니까?