Python mayavi.mlab.triangular_mesh() Examples
The following are 6
code examples of mayavi.mlab.triangular_mesh().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mayavi.mlab
, or try the search function
.
Example #1
Source File: grasp_sampler.py From PointNetGPD with MIT License | 5 votes |
def show_grasp_3d(self, hand_points, color=(0.003, 0.50196, 0.50196)): # for i in range(1, 21): # self.show_points(p[i]) if color == 'd': color = (0.003, 0.50196, 0.50196) triangles = [(9, 1, 4), (4, 9, 10), (4, 10, 8), (8, 10, 12), (1, 4, 8), (1, 5, 8), (1, 5, 9), (5, 9, 11), (9, 10, 20), (9, 20, 17), (20, 17, 19), (17, 19, 18), (14, 19, 18), (14, 18, 13), (3, 2, 13), (3, 13, 14), (3, 6, 7), (3, 6, 2), (3, 14, 7), (14, 7, 16), (2, 13, 15), (2, 15, 6), (12, 20, 19), (12, 19, 16), (15, 11, 17), (15, 17, 18), (6, 7, 8), (6, 8, 5)] mlab.triangular_mesh(hand_points[:, 0], hand_points[:, 1], hand_points[:, 2], triangles, color=color, opacity=0.5)
Example #2
Source File: mesh_visualizer.py From PointNetGPD with MIT License | 5 votes |
def visualize(self, color=(0.5, 0.5, 0.5), style='surface', opacity=1.0): """Plots visualization of mesh using MayaVI. Parameters ---------- color : :obj:`tuple` of float 3-tuple of floats in [0,1] to give the mesh's color style : :obj:`str` Either 'surface', which produces an opaque surface, or 'wireframe', which produces a wireframe. opacity : float A value in [0,1] indicating the opacity of the mesh. Zero is transparent, one is opaque. Returns ------- :obj:`mayavi.modules.surface.Surface` The displayed surface. """ surface = mv.triangular_mesh(self.mesh_.vertices_[:,0], self.mesh_.vertices_[:,1], self.mesh_.vertices_[:,2], self.mesh_.triangles_, representation=style, color=color, opacity=opacity) return surface
Example #3
Source File: mesh_visualizer.py From meshpy with Apache License 2.0 | 5 votes |
def visualize(self, color=(0.5, 0.5, 0.5), style='surface', opacity=1.0): """Plots visualization of mesh using MayaVI. Parameters ---------- color : :obj:`tuple` of float 3-tuple of floats in [0,1] to give the mesh's color style : :obj:`str` Either 'surface', which produces an opaque surface, or 'wireframe', which produces a wireframe. opacity : float A value in [0,1] indicating the opacity of the mesh. Zero is transparent, one is opaque. Returns ------- :obj:`mayavi.modules.surface.Surface` The displayed surface. """ surface = mv.triangular_mesh(self.mesh_.vertices_[:,0], self.mesh_.vertices_[:,1], self.mesh_.vertices_[:,2], self.mesh_.triangles_, representation=style, color=color, opacity=opacity) return surface
Example #4
Source File: utils.py From meshcut with MIT License | 5 votes |
def trimesh3d(verts, faces, **kwargs): mlab.triangular_mesh(verts[:, 0], verts[:, 1], verts[:, 2], faces, **kwargs)
Example #5
Source File: mesh.py From cmm with GNU General Public License v2.0 | 5 votes |
def vismesh(pts, tris, color=None, edge_visibility=False, shader=None, triangle_scalars=None, colors=None, **kwargs): if 'scalars' in kwargs and np.asarray(kwargs['scalars']).ndim == 2: colors = kwargs['scalars'] del kwargs['scalars'] tm = mlab.triangular_mesh(pts[:,0], pts[:,1], pts[:,2], tris, color=color, **kwargs) if shader is not None: tm.actor.property.load_material(shader) tm.actor.actor.property.shading = True diffuse = 1.0 if colors is not None else 0.8 tm.actor.actor.property.set( edge_visibility=edge_visibility, line_width=1, specular=0.0, specular_power=128., diffuse=diffuse) if triangle_scalars is not None: tm.mlab_source.dataset.cell_data.scalars = triangle_scalars tm.actor.mapper.set(scalar_mode='use_cell_data', use_lookup_table_scalar_range=False, scalar_visibility=True) if "vmin" in kwargs and "vmax" in kwargs: tm.actor.mapper.scalar_range = kwargs["vmin"], kwargs["vmax"] if colors is not None: # this basically is a hack which doesn't quite work, # we have to completely replace the polydata behind the hands of mayavi tm.mlab_source.dataset.point_data.scalars = colors.astype(np.uint8) tm.actor.mapper.input = tvtk.PolyDataNormals( input=tm.mlab_source.dataset, splitting=False).output return tm
Example #6
Source File: maya_widget.py From 3D-Human-Body-Shape with MIT License | 5 votes |
def update_plot(self, v, f): mlab.clf() if not isinstance(v, str): mlab.triangular_mesh(v[:, 0], v[:, 1], v[:, 2], f) # the layout of the dialog screated