def test_multi_renderers(): plotter = vtki.Plotter(shape=(2, 2), off_screen=OFF_SCREEN) loc = (0, 0) plotter.add_text('Render Window 0', loc=loc, font_size=30) sphere = vtki.Sphere() plotter.add_mesh(sphere, loc=loc, scalars=sphere.points[:, 2]) plotter.add_scalar_bar('Z', vertical=True) loc = (0, 1) plotter.add_text('Render Window 1', loc=loc, font_size=30) plotter.add_mesh(vtki.Cube(), loc=loc, show_edges=True) loc = (1, 0) plotter.add_text('Render Window 2', loc=loc, font_size=30) plotter.add_mesh(vtki.Arrow(), color='y', loc=loc, show_edges=True) plotter.subplot(1, 1) plotter.add_text('Render Window 3', loc=loc, font_size=30) plotter.add_mesh(vtki.Cone(), color='g', loc=loc, show_edges=True, backface_culling=True) plotter.add_bounding_box(render_lines_as_tubes=True, line_width=5) plotter.show_bounds(all_edges=True) plotter.update_bounds_axes() plotter.plot()
def test_cone(): cone = vtki.Cone() assert np.any(cone.points) assert np.any(cone.faces)
""" import vtki ################################################################################ # This runs through several of the available geomoetric objects available in VTK # which ``vtki`` provides simple conveinance methods for generating. # # Let's run through creating a few geometric objects! cyl = vtki.Cylinder() arrow = vtki.Arrow() sphere = vtki.Sphere() plane = vtki.Plane() line = vtki.Line() box = vtki.Box() cone = vtki.Cone() poly = vtki.Polygon() disc = vtki.Disc() ################################################################################ # Now let's plot them all in one window p = vtki.Plotter(shape=(3, 3)) # Top row p.subplot(0,0) p.add_mesh(cyl, color='tan', show_edges=True) p.subplot(0,1) p.add_mesh(arrow, color='tan', show_edges=True) p.subplot(0,2) p.add_mesh(sphere, color='tan', show_edges=True) # Middle row
plotter.subplot(0, 1) plotter.add_text('Render Window 1', font_size=30) plotter.add_mesh(vtki.Cube(), show_edges=True, color='orange') plotter.subplot(1, 0) plotter.add_text('Render Window 2', font_size=30) sphere = vtki.Sphere() plotter.add_mesh(sphere, scalars=sphere.points[:, 2]) plotter.add_scalar_bar('Z', vertical=True) # plotter.add_axes() plotter.add_axes(interactive=True) plotter.subplot(1, 1) plotter.add_text('Render Window 3', font_size=30) plotter.add_mesh(vtki.Cone(), color='g', show_edges=True) plotter.show_bounds(all_edges=True) # Display the window plotter.show() ################################################################################ import vtki from vtki import examples plotter = vtki.Plotter(shape=(1, 2)) # Note that the (0, 0) location is active by default # load and plot an airplane on the left half of the screen plotter.add_text('Airplane Example\n', font_size=30)