Skip to contents

Generic function that extracts an isosurface from a volumetric scalar field. Currently implemented for objects of class sdf_volume (returned by signed_distance_function()).

Usage

extract_isosurface(x, isovalue = 0, ...)

# S3 method for class 'sdf_volume'
extract_isosurface(x, isovalue = 0, ...)

# Default S3 method
extract_isosurface(x, isovalue = 0, ...)

Arguments

x

An object from which to extract an isosurface.

isovalue

Numeric. The iso-level at which to extract the surface.

...

Additional arguments passed to methods.

Value

A mesh3d object (from package rgl).

See also

Other sdf_transforms: sdf_volume, signed_distance_function()

Examples

if (rlang::is_installed("rgl")) {
f <- system.file("extdata", "torus.stl", package = "vespa")
mesh <- read_stl(f)
torus_sdf <- signed_distance_function(mesh, base_resolution = 32L, padding = 3L)
torus_fat <- extract_isosurface(torus_sdf, isovalue = .3)
rgl::plot3d(torus_fat)
torus_shrink <- extract_isosurface(torus_sdf, isovalue = -.15)
rgl::plot3d(torus_shrink)
}
#> SDF grid: 141 × 141 × 38 — 755,478 voxels, ~5.8 Mb