Skip to main content

Fast isosurface extraction using surface-following regularised marching tetrahedra

Project description

Fast surface-following isosurface extraction

This library implements a surface-following variant of regularised marching tetrahedra (RMT) for extracting isosurfaces from implicit scalar fields.

Traditional isosurface extraction methods, such as marching cubes and marching tetrahedra, usually sample the full volume of interest. That can be expensive for costly implicit functions, and can produce meshes with large numbers of poorly shaped triangles.

Regularised marching tetrahedra combines marching tetrahedra with vertex clustering. The result is an isosurface mesh that remains consistent with the sampled field while typically using fewer faces and producing better-shaped triangles than standard marching tetrahedra or marching cubes.

This crate extends RMT with surface-following extraction. Instead of evaluating the implicit function across the entire volume, extraction starts from one or more user-provided seed points and expands across the surface. This is particularly useful for signed-distance fields, radial basis function (RBF) interpolants, and other implicit functions where evaluations are expensive and an approximate surface location is already known.

Seed points do not need to lie exactly on the target isosurface. Before wavefront expansion begins, each seed is projected onto the surface using a gradient-based search. Users may provide an analytic gradient function, or allow gradients to be estimated from the scalar field using central differences.

See the examples section for complete usage examples.


Features

  • Written in Rust
  • Regularised marching tetrahedra with vertex clustering
  • Reduced evaluation counts compared with full-volume sampling
  • Improved triangle quality compared with standard marching tetrahedra
  • Manifold, self-intersection-free mesh generation
  • Optional watertight extraction against an axis-aligned bounding box (AABB)

Install

pip install ferreus_rmt

Quick start

import numpy as np
from ferreus_rmt import build_isosurface

# Define the implicit function for a sphere.
def surface_fn(points: np.ndarray) -> np.ndarray:
    radius = 1.0
    return np.linalg.norm(points, axis=1) - radius

# Define the axis-aligned bounding box extents to extract the isosurface within:
# [xmin, ymin, zmin, xmax, ymax, zmax].
extents = np.array([-1.2, -1.2, -1.2, 1.2, 1.2, 1.2], dtype=np.float64)

# Define the resolution of the sample lattice.
resolution = 0.2

# Define the isovalue of the implicit function to surface.
isovalue = 0.0

# Define some seed points on, or near, the isosurface to seed the wavefront.
seed_points = np.array([[1.0, 0.0, 0.0], [-1.0, 0.0, 0.0]], dtype=np.float64)

# Extract the isosurface
mesh = build_isosurface(
    seed_points,
    extents,
    resolution,
    isovalue,
    surface_fn,
)

# Save the isosurface out to an obj file
mesh.save_obj("sphere.obj", "sphere")

Implicit sphere isosurface


References

  1. G.M. Treece, R.W. Prager, and A.H. Gee. Regularised marching tetrahedra: improved iso-surface extraction. Computers & Graphics, 23(4):583–598, 1999.

Attribution and licensing

This package was developed while the author was working at Maptek and has been approved for open-source distribution under the terms of the MIT license.

Unless otherwise stated, the following copyright applies:

Copyright (c) 2026 Maptek Pty Ltd.
All rights reserved.

This copyright applies to all files in this repository, whether or not an individual file contains an explicit notice.

The code is released under the MIT License - see the top-level LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ferreus_rmt-0.1.0-cp38-abi3-win_amd64.whl (910.9 kB view details)

Uploaded CPython 3.8+Windows x86-64

ferreus_rmt-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.39+ x86-64

ferreus_rmt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (641.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

ferreus_rmt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (913.9 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file ferreus_rmt-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: ferreus_rmt-0.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 910.9 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ferreus_rmt-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 539d8449b01f4b71e2103a201a7627f09eb566c6e458e8b802f9c63296c2a504
MD5 930dcc8d967cd00cfcae397f377ab46a
BLAKE2b-256 8bbb5696c9e840875333ae4500c420dc075215d6283c32ab08bcbbc93aa7433e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferreus_rmt-0.1.0-cp38-abi3-win_amd64.whl:

Publisher: publish-py-ferreus-rmt.yml on graphic-goose/ferreus_rbf_rs

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

File details

Details for the file ferreus_rmt-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for ferreus_rmt-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2903cc6915a569da6bcf7f0c71dda80279defa00c40779186f726abbd225f037
MD5 d377fdd52d526de8145650e01f1cde5f
BLAKE2b-256 e1f384fbe54e991be6bbcc6f404a3190e410f12d16609fd916a00bb77c9b3ec7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferreus_rmt-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl:

Publisher: publish-py-ferreus-rmt.yml on graphic-goose/ferreus_rbf_rs

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

File details

Details for the file ferreus_rmt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferreus_rmt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 38a8b07a211355748aac7d7cc797c4f17ccbc1c78b3db7b20c5050137fdb3642
MD5 3dda1d7ac101124746f4176cc257f985
BLAKE2b-256 71d56f84c8f15eeb9ca60086ce0c61790485608610368bf11399370beea8918c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferreus_rmt-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: publish-py-ferreus-rmt.yml on graphic-goose/ferreus_rbf_rs

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

File details

Details for the file ferreus_rmt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ferreus_rmt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4fadc640b7e37abda89f5512312fdec1b3d9a084e410b7dcabb6a9716bdd6394
MD5 8649609e77fcc6eb23fe80ab07f8690c
BLAKE2b-256 f60ffcd1dc98787f97857efee5fdc291e037b4991f34b4642556622327be44bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferreus_rmt-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-py-ferreus-rmt.yml on graphic-goose/ferreus_rbf_rs

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