Skip to main content

JAX-based mesh primitives and isosurface extraction

Project description

jaxmesh

JAX-based mesh primitives and isosurface extraction.

Installation

pip install jaxmesh

Quick Start

import jax.numpy as jnp
from jaxmesh import marching_tetrahedra, rectilinear_grid, save_mesh_as_ply

# Create a grid
x = jnp.linspace(-1, 1, 32)
coords = rectilinear_grid(x, x, x)

# Define a scalar field (sphere SDF)
field = jnp.sqrt(coords[..., 0]**2 + coords[..., 1]**2 + coords[..., 2]**2) - 0.5

# Extract isosurface
mesh = marching_tetrahedra(field, coords, level=0.0)

# Save to file
save_mesh_as_ply(mesh, "sphere.ply")

Features

Mesh Types

  • SimplexMesh - Base class for simplex meshes
  • TriMesh - Triangle mesh with barycentric coordinates and gradients
  • TetMesh - Tetrahedral mesh with barycentric utilities
  • QuadMesh - Quad mesh convertible to triangles
  • HexMesh - Hexahedral mesh convertible to tetrahedra

Isosurface Extraction

  • marching_tetrahedra(field, coords, level) - Extract triangle mesh from scalar field
  • rectilinear_grid(x, y, z) - Create structured 3D grid coordinates
  • decimate_mesh(mesh, max_faces) - Reduce mesh complexity

Geometry Utilities

  • compute_vertex_normals(mesh) - Per-vertex normals
  • triangle_barycentric_weights(vertices, point) - Barycentric coordinates
  • tetra_barycentric_weights(vertices, point) - Barycentric coordinates

Level-Set Utilities

  • triangle_edge_intersections(values, level) - Find edge crossings
  • tetra_edge_intersections(values, level) - Find edge crossings
  • triangle_zero_segment(vertices, values, level) - Extract level-set segment
  • tetra_zero_triangles(vertices, values, level) - Extract level-set facets

I/O

  • save_mesh_as_ply(mesh, path) - ASCII PLY export with normals
  • save_mesh_as_glb(mesh, path) - Binary glTF export

License

MIT

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

jaxmesh-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

jaxmesh-0.1.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file jaxmesh-0.1.0.tar.gz.

File metadata

  • Download URL: jaxmesh-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for jaxmesh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 08bebe9ccebed2e2f196877bec475d75d06f015bced353d13612397e60a07cfd
MD5 959f26bbe9bdf5ab0e1e16fa625bb3cf
BLAKE2b-256 35b17e1d7cc33296022a84c81ddef6620533afc05092834e136ba5072a4347e6

See more details on using hashes here.

File details

Details for the file jaxmesh-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jaxmesh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for jaxmesh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd680f044bba3b5b0bc5ef0786b7eb515616c677e330a583a935665aa21fe65b
MD5 1e56e2a1f19e88d8f7e728673281bd58
BLAKE2b-256 b8538f6a0dbf313cb7b9a973b5468903a66d0106af29ccc8dda68561e0aa51f3

See more details on using hashes here.

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