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

Elvis Dowson elvis.dowson at mac.com
Thu Oct 9 01:12:33 EDT 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081009/c4fe32dc/attachment.htm>


More information about the vtkusers mailing list