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.3.0.tar.gz (28.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.3.0-py3-none-any.whl (55.8 kB view details)

Uploaded Python 3

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

Hashes for liblaf_melon-1.3.0.tar.gz
Algorithm Hash digest
SHA256 9d05c9f6554503b8a7eab74080c21471cfd2e603c5c24a85ae9fde45ac9f4b76
MD5 e4fdbe377d11b8a1a4a48ccbb7bee6f8
BLAKE2b-256 2f0c2544f80e324d4927c76a4dba41a51969966882e5ffd65540239308cd969e

See more details on using hashes here.

Provenance

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

Hashes for liblaf_melon-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89848e47c8d041ce1a1cfe3fc71c9ce741bd3ed18454bdc372f0d86629093778
MD5 9d23df450a4803672c79d7ead2ed0c1f
BLAKE2b-256 fefcc54455cf3991a248d89e91eedafeceb6e5a56540efdb2e05f41fbd028122

See more details on using hashes here.

Provenance

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