I hope to use vtkStructuredGridClip to achieve cutting vtkStructuredGrid data with a plane, but I can’t find the sample code in vtkStructuredGridClip Class Reference, which caused me a lot of difficulties, I hope to get a solution
I try to use vtkCutter to achieve plane cutting vtkstructured grid, but the display result is dark
structuredGrid->SetPoints(points);
structuredGrid->GetCellData()->SetScalars(pressureArray);
//structuredGrid->GetPointData()->SetScalars(tempArray);
vtkSmartPointer<vtkPlane> plane =
vtkSmartPointer<vtkPlane>::New();
plane->SetOrigin(50.0, 50.0, 50.0);
plane->SetNormal(1.0, 1.0, 1.0);
vtkSmartPointer<vtkCutter> cutter =
vtkSmartPointer<vtkCutter>::New();
cutter->SetCutFunction(plane);
cutter->SetInputData(structuredGrid);
cutter->Update();
vtkSmartPointer<vtkDataSetMapper> mapper =
vtkSmartPointer<vtkDataSetMapper>::New();
mapper->SetInputConnection(cutter->GetOutputPort());
vtkSmartPointer<vtkActor> actor =
vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
renderer->AddActor(actor);
renderWindow->Render();
interactor->Start();