Repository navigation
levelset(): let edge be one spacing per axis - #274
Merged
Merged
Conversation
edge=[ex,ey,ez] (or [ex,ey] in 2D) samples each axis at its own spacing,
as BOSL2's isosurface() takes voxel_size. Manifold's LevelSet takes one
edge length, so the 3D path meshes the field squashed to unit spacing and
scales the mesh back, which is exact: with tolerance -1 a vertex is a
linear interpolation along a lattice edge, and that commutes with an axis
scale. A plain number takes the old path unchanged.
Also: a non-positive edge= on a grid field now falls back to the grid
spacing instead of handing Manifold an edge length of 0.
supported_feature("levelset") is now 2, so a library can tell a build
that accepts a vector edge from one that rejects it.
Refs BelfrySCAD/BelfrySCAD#729
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs BelfrySCAD/BelfrySCAD#729
edge=[ex,ey,ez](or[ex,ey]for a 2Dbounds) samples each axis at its own spacing — the equivalent of BOSL2isosurface()'s vectorvoxel_size, which the reporter needs to uselevelset()as a drop-in for BOSL2's marching cubes.How:
Manifold::LevelSettakes a single edge length, so the 3D path meshes the field squashed to unit spacing on every axis andScales the mesh back. This is exact, not an approximation: with tolerance −1 each vertex is a linear interpolation along a lattice edge, and that commutes with an axis scale.AVectorEdgeIsExactlyAStretchedLatticepins it: a sphere stretched 4× in z, sampled 4× coarser in z, gives the same triangle count and exactly 4× the volume (1e-6). The 2D path already had separate x/y spacings, so it just reads them from the vector.A plain number takes the old code path unchanged, so existing scripts mesh identically.
Also fixed on the way: a non-positive
edge=given with a grid field warned, then leftedgeat 0 and passed that toLevelSet; it now falls back to the grid spacing.Feature level:
supported_feature("levelset")is now 2, so a library can probe for a vector edge.FeatureDetection.EveryDocumentedFeatureReportsALevelchecked for the digit1in the echo; it now checks>= 1.closed=false(also asked for in the issue) is not included: it means an open surface, which can't be a solid.Tests: 6 new
LevelSetFncases; full suite 1485 passed, 0 failed.🤖 Generated with Claude Code