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.2.0.tar.gz (22.3 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.2.0-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liblaf_melon-1.2.0.tar.gz
  • Upload date:
  • Size: 22.3 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.2.0.tar.gz
Algorithm Hash digest
SHA256 91f78e8c0899765c768dc4815684ff393681404c6c56ebd62f2dbf6cccf7bd57
MD5 1c3ab1f9ee8ed29cf1389b4b55969042
BLAKE2b-256 4d7fa6facc05cf2335952e6f0b18fe2d098e18843e91ab927527368cacea9b77

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_melon-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: liblaf_melon-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 42.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c2ce52d985e87da1e703067f107b89634002113d9f2e0fb8dcbf6e59cfa21c6
MD5 58869fc5f18ab07f5934a5968c53893d
BLAKE2b-256 f17e4c52058b5d557f0671ca844d2f8cb476f3b8cc35648da7c1fa4a4fb261e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for liblaf_melon-1.2.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