[vtkusers] How to extract poly data from an unstructured grid

Dominik Szczerba dominik at itis.ethz.ch
Thu Oct 9 03:07:02 EDT 2008


ExtractSurface filter.

Dominik

On Thursday 09 October 2008 07:12:33 am Elvis Dowson wrote:
> Hi,
>          I have an example code fragment shown below. How can I
> extract vtkPolyData from the vtkUnstructuredGrid?
>
> # Create an unstructured grids containing a triangle cell.
> vtkPoints trianglePoints
>    trianglePoints SetNumberOfPoints 3
>    trianglePoints InsertPoint 0 0 0 0
>    trianglePoints InsertPoint 1 1 0 0
>    trianglePoints InsertPoint 2 .5 .5 0
> vtkTriangle aTriangle
>    [aTriangle GetPointIds] SetId 0 0
>    [aTriangle GetPointIds] SetId 1 1
>    [aTriangle GetPointIds] SetId 2 2
> vtkUnstructuredGrid aTriangleGrid
>    aTriangleGrid Allocate 1 1
>    aTriangleGrid InsertNextCell [aTriangle GetCellType] [aTriangle
> GetPointIds]
>    aTriangleGrid SetPoints trianglePoints
>
> I want to get a vtkPolyData object so that I can pass it along to
> vtkPolyDataNormals.
>
> Best regards,
>
> Elvis Dowson



-- 
Dominik Szczerba, Ph.D.
Computational Physics Group
Foundation for Research on Information Technologies in Society
http://www.itis.ethz.ch



More information about the vtkusers mailing list