Skip to main content

mesh extract and render by python

Project description

########### Basic Installation ###########

This project for mesh render in data science.

conda create -n pymesh3d python=3.6
conda activate pymesh3d
pip install --upgrade pip
pip install pymesh3d

If you need mayavi backend.

conda config --add channels conda-forge
conda install vtk pyqt mayavi

############### Quick Start ###############

import pymesh
import numpy as np
import matplotlib.pyplot as plt

Look at the directory example for full example.

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

png

################ plt example #################

surf = mesh.plt_trisurf(cmap = plt.cm.jet)
plt.colorbar(surf, orientation = 'horizontal')
plt.tight_layout()

png

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

Uploaded Source

Built Distribution

pymesh3d-0.0.13-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymesh3d-0.0.13.tar.gz
  • Upload date:
  • Size: 6.6 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.13.tar.gz
Algorithm Hash digest
SHA256 4b23f3837a1dd3d9e9931992089e7e483c4a49ba2cf588bd4c3f8f3432252352
MD5 e2b425e19f36977d376d2171dd86517f
BLAKE2b-256 5893b84138014fbb9e64434f7b2d4946488f84c1090104156629bfb561828f65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymesh3d-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.13-py3-none-any.whl
Algorithm Hash digest
SHA256 423e5d941ed34a31d6e181762ce458e758e275c7d83f4a45852ac861631e1354
MD5 594418670c8b216b75d0ad61885039c5
BLAKE2b-256 dbfef7021c549bc3d3300b0a1f18d37e7e63b8afa1184996e29cd14c7de8baa8

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