简体   繁体   中英

Clipping in vtk surface rendered output

I had done surface rendering using vtk marching cubes and now I need to do clipping in that.

I searched and found how to do clipping in volume rendered output(ie; using ray casting method) .But I need to do clipping in surface rendered output. so I created a vtkClipPolyData

plane->SetOrigin(0.0, 0.0, pDoc->fBounds[4]);
plane->SetNormal(1.0, -1.0, -1.0);




clipper->SetInputConnection(//marchingcubes variable here//->GetOutputPort());
clipper->SetClipFunction(plane);
clipper->SetValue(.5);
clipper->Update();
polydata = clipper->GetOutput();//vtkPolyData//

mapper->SetInput(polydata);//vtkPolyDataMapper//
actor->SetMapper(mapper);//vtkActor//

And I am getting the clipped output.but the problem is I need to create a slider bar and as the slider is dragged the clipping should appear in axial view back and forth .Is my question clear? Can anybody help?

You can try using a vtkSliderWidget . There's an example of how to use it here . On its callback, you can set the clipping plane's position.

Another option: You could use a vtkImplicitPlaneWidget2 (note: the 2 there is because there's a new and an old version - use the '2' versions whenever possible).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM