Skip to main content

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()

png

##########################################
############# 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


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.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

pymesh3d-0.0.2-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pymesh3d-0.0.2.tar.gz.

File metadata

  • Download URL: pymesh3d-0.0.2.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

Hashes for pymesh3d-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0cc5ebda177c99f7d8d461ba69b2dde24191c11f69a243a7dd0ae070d23fc0e5
MD5 a84a5efde70627db3eb6d8c94a4fc4f7
BLAKE2b-256 f3a78977aeb3d64cab62c2ff49588bddc235ae5133ddd764730d80fc17960e66

See more details on using hashes here.

File details

Details for the file pymesh3d-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pymesh3d-0.0.2-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

Hashes for pymesh3d-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e2865fd90d6b4bba4d634ed4ff68f90396cc8fe2b5ca30f163dd1c6a0fd9c16
MD5 7ab2eba767052a91b6a0d13422beaf39
BLAKE2b-256 7d44707585574f5bd860f15fa70cbc33b506ed94ea6177fc233341ab784fd9c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page