Skip to main content

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:

Open in GitHub Codespaces

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.

PR Welcome

Contributors

🔗 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

Copyright © 2025 liblaf.
This project is MIT licensed.

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

liblaf_melon-1.5.0.tar.gz (29.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liblaf_melon-1.5.0-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file liblaf_melon-1.5.0.tar.gz.

File metadata

  • Download URL: liblaf_melon-1.5.0.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for liblaf_melon-1.5.0.tar.gz
Algorithm Hash digest
SHA256 490da7ae030926e8522dde1cd19165105ea0abed41dccc944b1dcbb0418d3276
MD5 cd54f62ba661dbfcdba78a6c27f06dd5
BLAKE2b-256 160dda46a4560d7d555bb7924118562c76b1728e9765e2bb82e34432369001e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_melon-1.5.0.tar.gz:

Publisher: python-release.yaml on liblaf/melon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liblaf_melon-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: liblaf_melon-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for liblaf_melon-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dbe5bce8c4452cc36b47560d744c2083b0a2f27463261ec74e7d2b11c27ad7b
MD5 714fa93a51015d8b7ca9762787f9dad6
BLAKE2b-256 fb24a0f69e213257f3b30a93826b0c6efc876889d1af7eb599eac2d4008f1f13

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_melon-1.5.0-py3-none-any.whl:

Publisher: python-release.yaml on liblaf/melon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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