Beispiel #1
0
"""Share the same color map
across different meshes"""
from vedo import Mesh, show, dataurl

#####################################
man1 = Mesh(dataurl + "man.vtk")
scals = man1.points()[:, 2] * 5 + 27  # pick z coordinates [18->34]
man1.cmap("rainbow", scals, vmin=18, vmax=44)

#####################################
man2 = Mesh(dataurl + "man.vtk")
scals = man2.points()[:, 2] * 5 + 37  # pick z coordinates [28->44]
man2.cmap("rainbow", scals, vmin=18, vmax=44).addScalarBar()

show([(man1, __doc__), man2], N=2, elevation=-40, axes=11)
Beispiel #2
0
"""Create a set of transparencies
which can be passed to method cmap()"""
from vedo import Mesh, show, dataurl

mesh = Mesh(dataurl + "beethoven.ply")

# pick y coordinates of vertices and use them as scalars
scals = mesh.points()[:, 1]

# define opacities in the range of the scalar,
# at min(scals) alpha is 0.1,
# at max(scals) alpha is 0.9:
alphas = [0.1, 0.1, 0.3, 0.4, 0.9]

mesh.cmap("copper", scals, alpha=alphas)
# print(mesh.getPointArray('PointScalars')) # retrieve scalars

show(mesh, __doc__, axes=9).close()
Beispiel #3
0
    v_cyclic=True,
    function=one_sheet_hyperboloid,
    adaptor_class=VtkAdaptor,
)
poly_data = DodecaTessagon(**options).create_mesh()
dodeca = Mesh(poly_data).x(5).computeNormals()
dodeca.lineWidth(1).backColor('tomato')


# ---------------------------------------------------------
def chubby_torus(u, v):
    return general_torus(5, 1.5, v, warp_var(u, 0.2))


options = dict(
    u_range=[0.0, 1.0],
    v_range=[0.0, 1.0],
    u_num=2,
    v_num=12,
    color_pattern=1,
    function=chubby_torus,
    adaptor_class=VtkAdaptor,
)
poly_data = FloretTessagon(**options).create_mesh()
poly_data.GetCellData().GetScalars().SetName("color_pattern")
floret = Mesh(poly_data).reverse().y(-9).scale(0.7)
floret.cmap('Greens_r', input_array="color_pattern", on='cells').lineWidth(0.1)

# ---------------------------------------------------------
show(rhombus, dodeca, floret, __doc__, axes=1)