|
|
Line 1: |
Line 1: |
− | This example demonstrates how to convert an unstructured grid to a polydata. Currently nothing is done with the resulting polydata. If someone has a good data set that demonstrates the conversion, please let us know.
| + | = '''See [https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/DataSetSurfaceFilter DataSetSurfaceFilter] on the new [https://lorensen.github.io/VTKExamples/site/ VTKExamples website].''' = |
− | | |
− | ==DataSetSurfaceFilter.cxx==
| |
− | <source lang="cpp">
| |
− | #include <vtkVersion.h>
| |
− | #include <vtkSmartPointer.h>
| |
− | #include <vtkPolyData.h>
| |
− | #include <vtkUnstructuredGrid.h>
| |
− | #include <vtkCellArray.h>
| |
− | #include <vtkDataSetSurfaceFilter.h>
| |
− | #include <vtkPointSource.h>
| |
− | | |
− | int main(int, char *[])
| |
− | {
| |
− | | |
− | vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid =
| |
− | vtkSmartPointer<vtkUnstructuredGrid>::New();
| |
− |
| |
− | vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter =
| |
− | vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
| |
− | #if VTK_MAJOR_VERSION <= 5
| |
− | surfaceFilter->SetInput(unstructuredGrid);
| |
− | #else
| |
− | surfaceFilter->SetInputData(unstructuredGrid);
| |
− | #endif
| |
− | surfaceFilter->Update();
| |
− |
| |
− | vtkPolyData* polydata = surfaceFilter->GetOutput();
| |
− | | |
− | std::cout << "Output has " << polydata->GetNumberOfPoints() << " points." << std::endl;
| |
− | | |
− | return EXIT_SUCCESS;
| |
− | }
| |
− | </source>
| |
− | | |
− | {{VTKCMakeLists|{{SUBPAGENAME}}}}
| |
− | | |
− | Perform a Delaunay triangulation on a sphere. Show it in wireframe so one can see all of the internal edges. Then run the filter and show that the result is only the outer surface.
| |
− | [[Category:VTKAddVisualization]]
| |