Skip to content

Commit 3e919bc

Browse files
Implement mesh simplification
1 parent 304b1eb commit 3e919bc

5 files changed

Lines changed: 1417 additions & 1 deletion

File tree

MIGRATION_GUIDE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,37 @@ API likewise moved from `#include "bioimage_cpp/mesh_smoothing.hxx"` and
19411941
`bioimage_cpp::smooth_mesh` to `#include "bioimage_cpp/mesh/smoothing.hxx"`
19421942
and `bioimage_cpp::mesh::smooth_mesh`.
19431943

1944+
### Mesh Simplification
1945+
1946+
Topology-preserving triangle-mesh simplification is available as
1947+
`bic.mesh.simplify_mesh`. It uses quadric-error edge collapses, preserves
1948+
manifold topology and open boundaries, and applies configurable soft penalties
1949+
to sharp features:
1950+
1951+
vertices, faces, _, values = bic.mesh.marching_cubes(
1952+
volume, level=0.5, allow_degenerate=False
1953+
)
1954+
vertices, faces, normals, values = bic.mesh.simplify_mesh(
1955+
vertices,
1956+
faces,
1957+
reduction=0.8,
1958+
values=values,
1959+
feature_angle=45.0,
1960+
feature_weight=10.0,
1961+
)
1962+
1963+
`reduction` is the approximate fraction of input faces to remove. A mesh can
1964+
stop above its target if no topology- and boundary-safe collapse remains.
1965+
Normals are recomputed from the final face geometry. Optional scalar values are
1966+
interpolated along collapsed edges; the fourth return item is `None` when
1967+
values are omitted. Vertices and values preserve float32/float64 input dtypes,
1968+
while returned faces are int64.
1969+
1970+
The input must be a non-empty, consistently oriented triangle 2-manifold with
1971+
no duplicate, zero-area, or unreferenced geometry. Use
1972+
`marching_cubes(..., allow_degenerate=False)` before simplification; invalid
1973+
meshes are rejected rather than silently repaired.
1974+
19441975

19451976

19461977
### Anti-Aliased Resampling

0 commit comments

Comments
 (0)