[vtkusers] structured grid -> normals at points

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Jan 5 18:49:53 EST 2004


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.

John Hunter



More information about the vtkusers mailing list