[vtkusers] Contouring an unstructured grid
Benjamin Schindler
bschindler at student.ethz.ch
Mon Dec 15 06:03:33 EST 2008
Hi
In the vtk Users Guide I read that it's possible to contour a
UnstructuredGrid using vtkContourFilter. I tried, but I got no visible
output, so I've got a few questions:
- How do I set the scalar for contouring?
- Am I missing something in the code below (besides setting active
scalar)? (Because paraview wasn't able to display anything as well even
though the data range seemed to match)
contourfilter = vtkContourFilter::New();
normals = vtkPolyDataNormals::New();
contourmapper = vtkPolyDataMapper::New();
contourActor = vtkActor::New();
contourfilter->SetNumberOfContours(1);
contourfilter->SetValue(0, 0);
contourfilter->SetInputConnection(reader->GetOutputPort());
normals->SetInputConnection(contourfilter->GetOutputPort());
contourmapper->SetInputConnection(normals->GetOutputPort());
contourActor->SetMapper(contourmapper);
renderer->AddActor(contourActor);
Thanks
Benjamin
More information about the vtkusers
mailing list