示例#1
0
######################################__add__
print('__add__', [cone+sphere], [vtk.vtkAssembly])
assert isinstance(cone+sphere, vtk.vtkAssembly)


###################################### points()
s2 = sphere.clone()
pts = sphere.points()
pts2 = pts + [1,2,3]
pts3 = s2.points(pts2).points()
print('points()',sum(pts3-pts2))
assert np.allclose(pts2, pts3)


###################################### faces
print('faces()', np.array(sphere.faces()).shape , (2112, 3))
assert np.array(sphere.faces()).shape == (2112, 3)


###################################### texture
st = sphere.clone().texture('wood2')
print('texture test')
assert isinstance(st.GetTexture(), vtk.vtkTexture)


###################################### deletePoints
sd = sphere.clone().deletePoints(range(100))
print('deletePoints',sd.N() , sphere.N())
assert sd.N() == sphere.N()
print('deletePoints',sd.NCells() ,'<', sphere.NCells())
assert sd.NCells() < sphere.NCells()
示例#2
0
######################################__add__
print('Test __add__')
assert isinstance(cone + sphere, vtk.vtkAssembly)

###################################### points()
print('Test points')

s2 = sphere.clone()
pts = sphere.points()
pts2 = pts + [1, 2, 3]
pts3 = s2.points(pts2).points()
assert np.allclose(pts2, pts3)

###################################### faces
print('Test faces', np.array(sphere.faces()).shape)
assert np.array(sphere.faces()).shape == (2112, 3)

###################################### texture
print('Test texture')
st = sphere.clone().texture('wood2')
assert isinstance(st.GetTexture(), vtk.vtkTexture)

###################################### deletePoints
print('Test deletePoints')
sd = sphere.clone().deletePoints(range(100))
assert sd.N() == sphere.N()
assert sd.NCells() < sphere.NCells()

###################################### reverse
print('Test reverse')