from vtk import * import sys pts = vtkPoints() polys = vtkCellArray() pd = vtkPolyData() pd.SetPoints(pts) pd.SetPolys(polys) pts.InsertNextPoint(250.0,50.0,0.0) pts.InsertNextPoint(325.0,200.0,0.0) pts.InsertNextPoint(400.0,50.0,0.0) pts.InsertNextPoint(250.0,150.0,0.0) pts.InsertNextPoint(400.0,150.0,0.0) # define contour polys.InsertNextCell(5) polys.InsertCellPoint(0) polys.InsertCellPoint(1) polys.InsertCellPoint(2) polys.InsertCellPoint(3) polys.InsertCellPoint(4) gtf = vtkGLUTesselatorFilter() gtf.SetInput(pd) # try these gtf.SetWindingRuleToPositive() #gtf.SetWindingRuleToOdd() #gtf.SetWindingRuleToNonZero() #gtf.SetWindingRuleToNegative() #gtf.SetWindingRuleToAbsGEqTwo() print(gtf) pdm = vtkPolyDataMapper() pdm.SetInput(gtf.GetOutput()) actor = vtkActor() actor.SetMapper(pdm) actor.GetProperty().SetColor(0,0,1) ren = vtkRenderer() renwin = vtkRenderWindow() renwin.AddRenderer(ren) iren = vtkRenderWindowInteractor() iren.SetRenderWindow(renwin) ren.AddActor(actor) ren.SetBackground(1,1,1) renwin.SetSize(600,600) iren.Initialize renwin.Render() iren.Start()