[vtkusers] Trouble displaying slice created with vtkCutter

Jonathan Lin jonathan.s.lin at vanderbilt.edu
Thu Jul 8 18:57:08 EDT 2004


Hello all,

I cannot display a slice I created using vtkCutter. The render window comes up, but there is nothing in it. Besides that, my code compiles and executes just fine. Has any other person had similar or related problems, and could give me hints? 

I have also tried using vtkClipPolyData, and got the same problem. And when I used vtkKitwareCutter, I got the whole mesh displayed. My subcommands for both were equivalent to that seen with vtkCutter below.

I cannot see what's wrong, so hopefully somebody else can. Otherwise, I would be drawn to think there is a flaw in the toolkit, and I have no wish to be the first vtk conspiracy theorist, as my stupidity likely has greater explanatory power.

Regards,
Jonathan

  // Creates function with which to cut slice
  vtkPlane *plane = vtkPlane::New();
      plane->SetOrigin (0.0, 0.0, 0.0);
      plane->SetNormal (0.0, 1.0, 0.0);
      
  // Loads mesh (which is an instance of vtkPolyData) and plane. Use latter to cut former.
  vtkCutter *cutter = vtkCutter::New();
      cutter->SetInput( finalmesh->GetOutput() );
      cutter->SetCutFunction(plane);
      cutter->Update();

  // Maps slice to graphics primitives
  vtkPolyDataMapper *cutterMapper = vtkPolyDataMapper::New();
      cutterMapper->SetInput ( cutter->GetOutput() );
      cutterMapper->ScalarVisibilityOff();
    
  // Creates actor to render slice
  vtkActor *cut = vtkActor::New();
      cut->SetMapper (cutterMapper);
      

  // Creates renderer, render window, render window interactor
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();

  // Renders slice
  ren1->AddActor(cut);
  ren1->SetBackground(.2,.3,.5);
  renWin->AddRenderer(ren1);

  iren->SetRenderWindow(renWin);
  renWin->SetSize(300,300);
  renWin->Render();
  iren->Start();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040708/c7a48e6f/attachment.htm>


More information about the vtkusers mailing list