print('---------------------------------') print('vtkVersion', vtk.vtkVersion().GetVTKVersion()) print('---------------------------------') ##################################### cone = Cone(res=48) sphere = Sphere(res=24) carr = cone.cellCenters()[:, 2] parr = cone.points()[:, 0] cone.addCellArray(carr, 'carr') cone.addPointArray(parr, 'parr') carr = sphere.cellCenters()[:, 2] parr = sphere.points()[:, 0] sphere.addCellArray(carr, 'carr') sphere.addPointArray(parr, 'parr') sphere.addPointArray(np.sin(sphere.points()), 'pvectors') sphere.addElevationScalars() cone.computeNormals() sphere.computeNormals() ###################################### test clone() c2 = cone.clone() assert cone.N() == c2.N() assert cone.NCells() == c2.NCells() ###################################### test merge()
from vtkplotter import makeLUT, Sphere mesh = Sphere().lineWidth(0.1) # create some data array to be associated to points data = mesh.points()[:,2] data[10:20] = float('nan') # Build a lookup table of colors: # scalar color alpha lut1 = makeLUT([(-0.80, 'pink' ), (-0.33, 'green', 0.8), ( 0.67, 'red' ), ], vmin=-1, vmax=1, aboveColor='grey', belowColor='white', interpolate=False, ) mesh.pointColors(data, cmap=lut1).addScalarBar() #Avoid interpolating cell colors before mapping: #mesh.mapper.InterpolateScalarsBeforeMappingOff() mesh.show(axes=1, viewup='z')