Skip to content

Isosurface extraction

ferreus_rbf.isosurfacing.build_isosurface(seed_points, extents, resolution, isovalue, isosurface_fn, *, gradient_fn=None, cluster_method=ClusterMethod.CurvatureWeighted, boundary_closure=BoundaryClosure.None_, progress_callback=None)

Extract an isosurface using regularised marching tetrahedra.

Parameters:

Name Type Description Default
seed_points NDArray[float64]

Numpy array of points of shape (N, 3), where N is the number of seed points, to seed the isosurface extraction. The algorithm is most efficient when these points are on, or close to, the surface to be extacted, as it reduces the number of cells that need to be evaluated in order to extract the surface.

required
extents NDArray[float64]

AABB extents as a 1D numpy array in order of [minx, miny, minz, maxx, maxy, maxz].

required
resolution float

The isosurfacing resolution.

required
isovalue float

The value at which to extract the isosurface.

required
isosurface_fn Callable[[NDArray[float64]], NDArray[float64]]

Callable function to evaluate the cell points at isosurface extraction. Must take in a 2D numpy array of float64 3D point coordinates of shape (N, 3) and return a float64 values array of shape (N,) or (N, 1), where N is the number of points being evaluated.

required
gradient_fn Callable | None

Optional callable for evaluating values and gradients during seed projection. It must take a float64 array of point coordinates with shape (N, 3) and return a tuple of (values, gradients). Values must have shape (N,) or (N, 1), and gradients must have shape (N, 3). If not provided central-differences will be used to calculate gradients.

None
cluster_method Optional[ClusterMethod]

Vertex clustering method to use. If not provided, CurvatureWeighted will be used.

CurvatureWeighted
boundary_closure BoundaryClosure | None_

Boundary closure method to use. If None_, leaves clipped boundaries open.

None_
progress_callback Progress | None

Progress callback operator, by default None

None

Returns:

Type Description
Mesh

Extracted triangle mesh.

ferreus_rbf.isosurfacing.build_isosurfaces(seed_points, extents, resolution, isovalues, isosurface_fn, *, gradient_fn=None, cluster_method=ClusterMethod.CurvatureWeighted, boundary_closure=BoundaryClosure.None_, progress_callback=None)

Convenience wrapper for build_isosurface that can extract multiple meshes from a list of isovalues at once.

Parameters:

Name Type Description Default
seed_points NDArray[float64]

Numpy array of points of shape (N, 3), where N is the number of seed points, to seed the isosurface extraction. The algorithm is most efficient when these points are on, or close to, the surface to be extacted, as it reduces the number of cells that need to be evaluated in order to extract the surface.

required
extents NDArray[float64]

AABB extents as a 1D numpy array in order of [minx, miny, minz, maxx, maxy, maxz].

required
resolution float

The isosurfacing resolution.

required
isovalues list[float]

List of values at which to extract isosurfaces.

required
isosurface_fn Callable[[NDArray[float64]], NDArray[float64]]

Callable function to evaluate the cell points at isosurface extraction. Must take in a 2D numpy array of float64 3D point coordinates of shape (N, 3) and return a float64 values array of shape (N,) or (N, 1), where N is the number of points being evaluated.

required
gradient_fn Callable | None

Optional callable for evaluating values and gradients during seed projection. It must take a float64 array of point coordinates with shape (N, 3) and return a tuple of (values, gradients). Values must have shape (N,) or (N, 1), and gradients must have shape (N, 3). If not provided central-differences will be used to calculate gradients.

None
cluster_method Optional[ClusterMethod]

Vertex clustering method to use. If not provided, CurvatureWeighted will be used.

CurvatureWeighted
boundary_closure BoundaryClosure | None_

Boundary closure method to use. If None_, leaves clipped boundaries open.

None_
progress_callback Progress | None

Progress callback operator, by default None

None

Returns:

Type Description
list[Mesh]

Extracted triangle meshes for each isovalue.