本文整理汇总了Python中mayavi.mlab.triangular_mesh方法的典型用法代码示例。如果您正苦于以下问题:Python mlab.triangular_mesh方法的具体用法?Python mlab.triangular_mesh怎么用?Python mlab.triangular_mesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mayavi.mlab
的用法示例。
在下文中一共展示了mlab.triangular_mesh方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_grasp_3d
# 需要导入模块: from mayavi import mlab [as 别名]
# 或者: from mayavi.mlab import triangular_mesh [as 别名]
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)
示例2: visualize
# 需要导入模块: from mayavi import mlab [as 别名]
# 或者: from mayavi.mlab import triangular_mesh [as 别名]
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
示例3: trimesh3d
# 需要导入模块: from mayavi import mlab [as 别名]
# 或者: from mayavi.mlab import triangular_mesh [as 别名]
def trimesh3d(verts, faces, **kwargs):
mlab.triangular_mesh(verts[:, 0], verts[:, 1], verts[:, 2], faces,
**kwargs)
示例4: vismesh
# 需要导入模块: from mayavi import mlab [as 别名]
# 或者: from mayavi.mlab import triangular_mesh [as 别名]
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
示例5: update_plot
# 需要导入模块: from mayavi import mlab [as 别名]
# 或者: from mayavi.mlab import triangular_mesh [as 别名]
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