mesh extract and render by python
Project description
import pymesh
import numpy as np
import matplotlib.pyplot as plt
##########################################
############ Rotate Mesh Data ############
##########################################
wkdir = "../../Render"
ey = np.load(wkdir + "/Ez.npy")[::2, ::50]
m, n = ey.shape[0], ey.shape[1]
res = np.zeros([m, n, n])
pymesh.rotate(ey, res, ifhalf = False)
fig = plt.figure(figsize=(4, 3))
plt.contourf(res[:, int(n/2), :].T)
cbar = plt.colorbar()
##########################################
############# Save Mesh Data #############
##########################################
mesh = pymesh.get_iso_surf(res, contours_number = 4, cmap = plt.cm.jet)
color = pymesh.interp_color(mesh.iso_vals, pltmap = plt.cm.jet)
mesh.export(wkdir + "test", "obj")
##########################################
############# Load Mesh Data #############
##########################################
mesh = pymesh.Mesh.load(wkdir + "test", "obj")
##########################################
############# Plot Mesh Data #############
##########################################
from mayavi import mlab
mlab_mesh = pymesh.iso_surface(mesh, colormap = "RdBu")
mlab.colorbar()
mlab.show()
################ plt example #################
surf = mesh.plt_trisurf(cmap = plt.cm.jet)
plt.colorbar(surf, orientation = 'horizontal')
plt.tight_layout()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymesh3d-0.0.3.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file pymesh3d-0.0.3.tar.gz
.
File metadata
- Download URL: pymesh3d-0.0.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48ba5ece9e2d28e021a0c8dc1c2a2a6acadc2179dfff7a2ce8abadcddf318b35 |
|
MD5 | 41f2043a6dcd0bdf810cab41bf6adef6 |
|
BLAKE2b-256 | f165a5abd22d5b17c201bcf943a54dd6e49d28af4bb524ef703ddf4c948833ec |
File details
Details for the file pymesh3d-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pymesh3d-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db97e65fccf84a5ce29444c032fee385de88211bb16f5552b76a8040bb9a1e7 |
|
MD5 | dafbcb8214b23ebc1cb11984526c9be3 |
|
BLAKE2b-256 | ff8bd4ce7f5a6e1019d63ea139ec8782a252879afcf60fe5aa0be7083b2e63a4 |