enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.31k stars 284 forks source link

Calculating volume of a mesh/figure #710

Open uucokgis opened 6 years ago

uucokgis commented 6 years ago

Hello Mr. Ramachandran, I sent an email to you about my couple questions, today. I hope you enlight my way. However, my idea is If mayavi can calculate volume of a mesh, it would be amazing. You used " volume " word in scipy 2018 too but I don't think that word is same as mine. You mean volume as mesh, I mean calculated area with differenced Z. I hope that functionality will be in mayavi.

Thanks for everything. Mayavi is amazing thing and also powerful more than matplotlib. Maybe plotly could be better as considering that web things. But for backend, any of them can catch mayavi.

Best regards, Umut.

prabhuramachandran commented 6 years ago

VTK provides some functionality for this but I have not really used it too much. Here is a quick example that I had sent you:

import numpy as np
from mayavi import mlab
x, y = np.random.random((2, 1000))
s = x*x + y*y
z = np.ones_like(x)
src = mlab.pipeline.scalar_scatter(x, y, z, s)
ug = mlab.pipeline.delaunay2d(src)
mq = mlab.pipeline.user_defined(ug, filter='MeshQuality')
c2d = mlab.pipeline.cell_to_point_data(mq)
aa = mlab.pipeline.set_active_attribute(c2d)
surf = mlab.pipeline.surface(aa)

Configure the properties of the mesh quality in the UI and that should provide some information.

Thanks for your kind comments!