[vtkusers] structured grid -> normals at points

Amy Henderson amy.henderson at kitware.com
Tue Jan 6 09:00:16 EST 2004


At 05:49 PM 1/5/2004 -0600, John Hunter wrote:


>I have some grid data that I am storing in a vtkStructuredGrid.  I use
>vtkDataSetSurfaceFilter to define a surface.
>
>     grid = vtk.vtkStructuredGrid()
>     grid.SetDimensions(8,8,1)
>
>     # ...load some data ...
>     points = vtk.vtkPoints()
>     scalars = vtk.vtkFloatArray()
>
>     for label, xyz, scalar in entries:
>         points.InsertNextPoint(*xyz)
>         scalars.InsertNextValue(scalar)
>
>     grid.SetPoints(points)
>     grid.GetPointData().SetScalars(scalars)
>
>     filter = vtk.vtkDataSetSurfaceFilter()
>     filter.SetInput(grid)
>
>     mapper = vtk.vtkPolyDataMapper()
>     mapper.SetInput(filter.GetOutput())
>
>     wireActor = vtk.vtkActor()
>     wireActor.SetMapper(mapper)
>     property = wireActor.GetProperty()
>
>
>My question is: what is the best way to get the average surface normal
>at each of the points in 'points'.  Since each point has a number of
>polygonal faces abutting them, I need the average of these normals.
>
>Any pointers to relevant classes appreciated.

Take a look at vtkPolyDataNormals.  The on-line documentation for that 
class is here: 
http://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html.

- Amy


>John Hunter
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list