设置颜色
//actor->GetProperty()->SetColor(1, 1, 1);//jimmy:设置成白色
vtkNew colors;
actor->GetProperty()->SetColor(colors->GetColor3d("Peacock").GetData());
设置背景颜色及在两个视窗中显示:
vtkSmartPointer
colors =
vtkSmartPointer::New();
vtkSmartPointer renderer1 =
vtkSmartPointer::New();
renderer1->SetBackground(colors->GetColor3d("Slate_grey").GetData());
renderer1->AddActor(actor1);
renderer1->SetViewport(0, 0, 0.5, 1);
vtkSmartPointer renderer2 =
vtkSmartPointer::New();
renderer2->SetBackground(colors->GetColor3d("Slate_blue").GetData());
renderer2->AddActor(actor2);
renderer2->SetViewport(0.5, 0, 1, 1);
设置顶点文字
// Create a graph
vtkNew graph;
// Create an array for the vertex labels
vtkNew vertexIDs;
vertexIDs->SetNumberOfComponents(1);
vertexIDs->SetName("VertexIDs");
// Set the vertex labels
vertexIDs->InsertNextValue(660);//jimmy:设置点的文字
// Add the array to the graph
graph->GetVertexData()->AddArray(vertexIDs);