MCPcopy Create free account
hub / github.com/Kitware/VTK / testCells

Method testCells

Rendering/Core/Testing/Python/cells.py:65–787  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

63class 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

Callers

nothing calls this directly

Calls 15

vtkDataSetMapperClass · 0.85
vtkTriangleStripClass · 0.85
vtkPolyVertexClass · 0.85
vtkPentagonalPrismClass · 0.85
vtkHexagonalPrismClass · 0.85
InsertTuple2Method · 0.80
SetNumberOfIdsMethod · 0.80
SetVariableMethod · 0.80
AddVariableMethod · 0.80
SetDiffuseColorMethod · 0.80

Tested by

no test coverage detected