"""Manually build a mesh from points and faces""" from vedo import Mesh, printc, show verts = [(50,50,50), (70,40,50), (50,40,80), (80,70,50)] faces = [(0,1,2), (2,1,3), (1,0,3)] # (the first triangle face is formed by vertex 0, 1 and 2) # Build the polygonal Mesh object: mesh = Mesh([verts, faces]) mesh.backColor('violet').lineColor('tomato').lineWidth(2) labs = mesh.labels('id').c('black') # retrieve them as numpy arrays printc('points():\n', mesh.points(), c=3) printc('faces(): \n', mesh.faces(), c=3) show(mesh, labs, __doc__, viewup='z', axes=1).close()
vplt = Plotter(N=1, axes=0, offscreen=True) vplt.show(mesh, nnLatPoints, azimuth=a, elevation=e, roll=r, bg='black', zoom=z) vplt.screenshot(filename=os.path.join(outSubDir, '4_graph_withLATNN'), returnNumpy=False).close() updatedMesh = Mesh([vertices, updatedFaces]) updatedMesh.lineColor('white').lineWidth(1) updatedMesh.c('black') updatedMesh.backColor('white') vplt = Plotter(N=1, axes=0, offscreen=True) vplt.show(updatedMesh, nnLatPoints, azimuth=a, elevation=e, roll=r, bg='black', zoom=z) vplt.screenshot(filename=os.path.join(outSubDir, '5_updated_graph_zoomed_withLATNN'), returnNumpy=False).close() z = 1 vplt = Plotter(N=1, axes=0, offscreen=True)