[vtkusers] fast visualization of polygons

Prof. Andreas Gerber gerber at fh-biberach.de
Wed Jan 23 01:24:19 EST 2002


How can I display a lot of individual polygons very fast. I use somthing like 
this to add polygons to the scene:

        polygon = vtkPolygon()
        polygon.GetPointIds().SetNumberOfIds(numpoints)
        for p in range(numpoints):
            polygon.GetPointIds().SetId(p,p)

        polygonGrid = vtkUnstructuredGrid()
        polygonGrid.Allocate(1,1)
        polygonGrid.InsertNextCell(polygon.GetCellType(),  
        polygon.GetPointIds())        
        polygonGrid.SetPoints(points)

        self.M.append(vtkDataSetMapper())
        self.M[-1].SetInput(polygonGrid)

The mappers are appended to a vtkAppendFilter. 

In comparison to a program which uses GL this solution is fairly slow. 


Andreas 



More information about the vtkusers mailing list