def PlotAntsPlane(): """ DESCRIPTION Demonstrate how to create a plot class to plot multiple meshes while adding scalars and text. Plot two ants and airplane """ # load and shrink airplane airplane = vtkInterface.LoadMesh(planefile) pts = airplane.GetNumpyPoints() # gets pointer to array pts /= 10 # shrink # rotate and translate ant so it is on the plane ant = vtkInterface.LoadMesh(antfile) ant.RotateX(90) ant.Translate([90, 60, 15]) # Make a copy and add another ant ant_copy = ant.Copy() ant_copy.Translate([30, 0, -10]) # Create plotting object plobj = vtkInterface.PlotClass() plobj.AddMesh(ant, 'r') plobj.AddMesh(ant_copy, 'b') # Add airplane mesh and make the color equal to the Y position plane_scalars = pts[:, 1] plobj.AddMesh(airplane, scalars=plane_scalars, stitle='Plane Y\nLocation') plobj.AddText('Ants and Plane Example') plobj.Plot() del plobj
def PlotAnt(): """ Plot a red ant in wireframe""" ant = vtkInterface.LoadMesh(antfile) ant.Plot(color='r', style='wireframe')
def PlotAirplane(): """ Plot a white airplane """ airplane = vtkInterface.LoadMesh(planefile) airplane.Plot()
def LoadSphere(): """ Loads sphere ply mesh """ return vtkInterface.LoadMesh(spherefile)
def LoadAirplane(): """ Load ply airplane mesh """ return vtkInterface.LoadMesh(planefile)
def LoadAnt(): """ Load ply ant mesh """ return vtkInterface.LoadMesh(antfile)
""" associated with examples.rst """ import vtkInterface from vtkInterface import examples import numpy as np #============================================================================== # Plane screenshot #============================================================================== filename = examples.planefile mesh = vtkInterface.LoadMesh(filename) cpos = mesh.Plot(screenshot='airplane.png', color='yellow') #============================================================================== # Make wave gif #============================================================================== # Make data X = np.arange(-10, 10, 0.25) Y = np.arange(-10, 10, 0.25) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) # Create and plot structured grid sgrid = vtkInterface.GenStructSurf(X, Y, Z) # Make deep copy of points