pyvista / pyvista

3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)

Home Page:https://docs.pyvista.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add texture to cylinder

xfang1363 opened this issue · comments

import pyvista as pv
cylinder = pv.Cylinder(radius=5, height=20, capping=False)
plotter = pv.Plotter()
image_path = "Data/puppy.jpg"
texture = pv.read_texture(image_path)
cylinder.texture_map_to_plane()
cylinder.plot(texture=texture)
plotter.add_mesh(cylinder, texture=texture)
plotter.show()
360截图20240312155543100
The texture is added symmetrically, how can I fit the image exactly to the side of the cylinder?