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

Function generatePoly

Filters/Modeling/Testing/Python/TestBandedContourFilter5.py:47–74  ·  view source on GitHub ↗

Generate two quads and assign scalars 3--4--5 | | | 0--1--2

(scalars)

Source from the content-addressed store, hash-verified

45 ]
46
47def generatePoly(scalars):
48 """
49 Generate two quads and assign scalars
50 3--4--5
51 | | |
52 0--1--2
53 """
54 pts = vtkPoints()
55 nx=3
56 ny=int(len(scalars)/nx)
57 for y in range(0,ny):
58 for x in range(0,nx):
59 pts.InsertNextPoint(x,y,0)
60
61 connectivity=[(0,1,4,3),(1,2,5,4)]
62 quads = vtkCellArray()
63 for quad in connectivity:
64 quads.InsertNextCell(4,quad)
65
66 poly = vtkPolyData()
67 poly.SetPoints(pts)
68 poly.SetPolys(quads)
69
70 array=vtkDoubleArray()
71 for s in scalars:
72 array.InsertNextValue(s)
73 poly.GetPointData().SetScalars(array)
74 return poly
75
76
77def showBandedContours(poly,values,num):

Callers 1

Calls 12

SetPolysMethod · 0.80
SetScalarsMethod · 0.80
vtkPointsClass · 0.50
rangeClass · 0.50
vtkCellArrayClass · 0.50
vtkPolyDataClass · 0.50
vtkDoubleArrayClass · 0.50
InsertNextPointMethod · 0.45
InsertNextCellMethod · 0.45
SetPointsMethod · 0.45
InsertNextValueMethod · 0.45
GetPointDataMethod · 0.45

Tested by

no test coverage detected