简体   繁体   中英

Rotate properties Mayavi python

I am using Mayavi Data Visualizer to plot in python a 3D object using triangular_mesh, I am trying to chage the color of each triangle of the object with this code:

vertices: points of the object, faces: faces of the object, color: new color of each face of the object.

# Create the 3D object
mesh = triangular_mesh(vertices[:, 0], vertices[:, 1], vertices[:, 2],faces)

# Change the color of each face of the object
cell_data = mesh.mlab_source.dataset.cell_data
    cell_data.scalars = color
    cell_data.scalars.name = 'Cell data'
    cell_data.update()
mesh = mlab.pipeline.set_active_attribute(mesh,cell_scalars='Cell data')
mlab.pipeline.surface(mesh)

The above code works good, my problem is that I need to actualize the color after taking new data, having active the properties of rotate the object during the process. Somebody knows how can I do that?

I've tried draw() but i still can not rotate the object. I've tried show() And I can rotate the object but I have to close the window to the process continue

Your question is very difficult to parse and I am not sure specifically what operations you are having trouble with, but from what I can tell the major issue is not being able to dynamically update the surface object without calling mlab.show .

Try implementing a solution similar to the tutorial here which sets up GUI events to adjust the visualization as desired.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM