(self)
| 63 | class cells(vtkmodules.test.Testing.vtkTest): |
| 64 | |
| 65 | def testCells(self): |
| 66 | |
| 67 | # Demonstrates all cell types |
| 68 | # |
| 69 | # NOTE: the use of NewInstance/DeepCopy is included to increase |
| 70 | # regression coverage. It is not required in most applications. |
| 71 | |
| 72 | ren = vtkRenderer() |
| 73 | # turn off all cullers |
| 74 | ren.GetCullers().RemoveAllItems() |
| 75 | |
| 76 | renWin = vtkRenderWindow() |
| 77 | renWin.AddRenderer(ren) |
| 78 | renWin.SetSize(300, 150) |
| 79 | iRen = vtkRenderWindowInteractor() |
| 80 | iRen.SetRenderWindow(renWin); |
| 81 | |
| 82 | # create a scene with one of each cell type |
| 83 | |
| 84 | # Voxel |
| 85 | |
| 86 | voxelPoints = vtkPoints() |
| 87 | voxelPoints.SetNumberOfPoints(8) |
| 88 | voxelPoints.InsertPoint(0, 0, 0, 0) |
| 89 | voxelPoints.InsertPoint(1, 1, 0, 0) |
| 90 | voxelPoints.InsertPoint(2, 0, 1, 0) |
| 91 | voxelPoints.InsertPoint(3, 1, 1, 0) |
| 92 | voxelPoints.InsertPoint(4, 0, 0, 1) |
| 93 | voxelPoints.InsertPoint(5, 1, 0, 1) |
| 94 | voxelPoints.InsertPoint(6, 0, 1, 1) |
| 95 | voxelPoints.InsertPoint(7, 1, 1, 1) |
| 96 | |
| 97 | aVoxel = vtkVoxel() |
| 98 | aVoxel.GetPointIds().SetId(0, 0) |
| 99 | aVoxel.GetPointIds().SetId(1, 1) |
| 100 | aVoxel.GetPointIds().SetId(2, 2) |
| 101 | aVoxel.GetPointIds().SetId(3, 3) |
| 102 | aVoxel.GetPointIds().SetId(4, 4) |
| 103 | aVoxel.GetPointIds().SetId(5, 5) |
| 104 | aVoxel.GetPointIds().SetId(6, 6) |
| 105 | aVoxel.GetPointIds().SetId(7, 7) |
| 106 | |
| 107 | bVoxel = aVoxel.NewInstance() |
| 108 | bVoxel.DeepCopy(aVoxel) |
| 109 | |
| 110 | aVoxelGrid = vtkUnstructuredGrid() |
| 111 | aVoxelGrid.Allocate(1, 1) |
| 112 | aVoxelGrid.InsertNextCell(aVoxel.GetCellType(), aVoxel.GetPointIds()) |
| 113 | aVoxelGrid.SetPoints(voxelPoints) |
| 114 | |
| 115 | aVoxelMapper = vtkDataSetMapper() |
| 116 | aVoxelMapper.SetInputData(aVoxelGrid) |
| 117 | |
| 118 | aVoxelActor = vtkActor() |
| 119 | aVoxelActor.SetMapper(aVoxelMapper) |
| 120 | aVoxelActor.GetProperty().BackfaceCullingOn() |
| 121 | |
| 122 | # Hexahedron |
nothing calls this directly
no test coverage detected