Mesh processing helpers for PyVista, Trimesh, Warp, TetWild, PyMeshFix, and Faceform Wrap workflows.
Project description
✨ Features
- 🧭 Dispatch-based mesh I/O: Read PyVista datasets, convert between PyVista, Trimesh, MeshIO, and Warp meshes, and write registered objects by file suffix.
- 🗂️ Wrap sidecars: Load and save Faceform Wrap landmark and polygon-selection JSON files with predictable sidecar naming.
- 📐 Surface helpers: Select named OBJ groups, extract surfaces, compute edge lengths, orient normals, and compute geodesic paths.
- 🧱 Tetrahedral helpers: Repair tetra winding and estimate per-cell volume fractions against a closed triangular surface.
- 🔁 Data transfer: Move arrays from triangle cells to triangle points, then from triangle points to tetrahedral points.
- 🛠️ External integrations: Wrap PyMeshFix, TetWild, and Faceform Wrap project templates while keeping the core APIs small.
📦 Installation
uv add liblaf-melon
Melon requires Python 3.12 or newer and pulls in mesh-processing libraries such as PyVista, Trimesh, MeshIO, Warp, and PyTetWild.
🚀 Quick Start
import numpy as np
import pyvista as pv
from liblaf.melon import io, tet, tri, xfer
surface = pv.Sphere(theta_resolution=16, phi_resolution=16)
io.save(surface, "surface.vtp")
loaded = io.load_polydata("surface.vtp")
edge_lengths = tri.edge_length(loaded)
tetmesh = pv.UnstructuredGrid(
np.array([4, 0, 1, 2, 3]),
np.array([pv.CellType.TETRA]),
np.array(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
),
)
tetmesh = tet.fix_winding(tetmesh)
loaded.point_data["distance"] = np.linalg.norm(loaded.points, axis=1)
xfer.tri_point_to_tet_point(loaded, tetmesh, {"distance": -1.0})
⌨️ Local Development
You can use GitHub Codespaces for online development:
Or clone it for local development:
gh repo clone liblaf/melon
cd melon
mise run install
UV_FROZEN=1 uv run pytest -q
UV_FROZEN=1 mise run lint
UV_FROZEN=1 mise run docs:build
🤝 Contributing
Contributions of all types are welcome. For bugs, API ideas, or mesh workflow improvements, open an issue on GitHub.
🔗 More Projects
- 🍇 Grapes - Supercharge your Python with rich logging, precise timing, and seamless serialization.
- 🍊 Tangerine - Squeeze dynamic content into your files with Tangerine's template magic.
- 🍎 Apple - Differentiable physics simulation with elastic energy models and finite elements.
- 🍒 Cherries - Sweet experiment tracking with Comet, DVC, and Git integration.
📝 License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file liblaf_melon-1.3.0.tar.gz.
File metadata
- Download URL: liblaf_melon-1.3.0.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d05c9f6554503b8a7eab74080c21471cfd2e603c5c24a85ae9fde45ac9f4b76
|
|
| MD5 |
e4fdbe377d11b8a1a4a48ccbb7bee6f8
|
|
| BLAKE2b-256 |
2f0c2544f80e324d4927c76a4dba41a51969966882e5ffd65540239308cd969e
|
Provenance
The following attestation bundles were made for liblaf_melon-1.3.0.tar.gz:
Publisher:
python-release.yaml on liblaf/melon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liblaf_melon-1.3.0.tar.gz -
Subject digest:
9d05c9f6554503b8a7eab74080c21471cfd2e603c5c24a85ae9fde45ac9f4b76 - Sigstore transparency entry: 1777385834
- Sigstore integration time:
-
Permalink:
liblaf/melon@3aa882835063fb9a6f613f1e7676c805bdabe51b -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/liblaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yaml@3aa882835063fb9a6f613f1e7676c805bdabe51b -
Trigger Event:
release
-
Statement type:
File details
Details for the file liblaf_melon-1.3.0-py3-none-any.whl.
File metadata
- Download URL: liblaf_melon-1.3.0-py3-none-any.whl
- Upload date:
- Size: 55.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89848e47c8d041ce1a1cfe3fc71c9ce741bd3ed18454bdc372f0d86629093778
|
|
| MD5 |
9d23df450a4803672c79d7ead2ed0c1f
|
|
| BLAKE2b-256 |
fefcc54455cf3991a248d89e91eedafeceb6e5a56540efdb2e05f41fbd028122
|
Provenance
The following attestation bundles were made for liblaf_melon-1.3.0-py3-none-any.whl:
Publisher:
python-release.yaml on liblaf/melon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
liblaf_melon-1.3.0-py3-none-any.whl -
Subject digest:
89848e47c8d041ce1a1cfe3fc71c9ce741bd3ed18454bdc372f0d86629093778 - Sigstore transparency entry: 1777386660
- Sigstore integration time:
-
Permalink:
liblaf/melon@3aa882835063fb9a6f613f1e7676c805bdabe51b -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/liblaf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yaml@3aa882835063fb9a6f613f1e7676c805bdabe51b -
Trigger Event:
release
-
Statement type: