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.4.0.tar.gz (29.8 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.4.0-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: liblaf_melon-1.4.0.tar.gz
  • Upload date:
  • Size: 29.8 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.4.0.tar.gz
Algorithm Hash digest
SHA256 f3ad8b9aaabd30c2d7d370512c166c0e7b39f9fe57c833b0bea44ed60d437467
MD5 4a8817b454e3c2199e483edf49ebec45
BLAKE2b-256 5a70847cd80048f82c69b65e29c0d3145b3b2007633e557d1309955241009dec

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: liblaf_melon-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 57.9 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55efdeb4f623e939cee78c94a26161d9449ccbbfb8d1ae8941e1adaa96f5778f
MD5 5e47fec89999c9b3bc64f2bdb35e56a1
BLAKE2b-256 875eae8feaac67345ac42dd48ac7a4afccaec1c5acdf52838761b128f1b76366

See more details on using hashes here.

Provenance

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