Skip to content

fix(core): open_top guard, deterministic bevel(all/sharp), and centered voxel remesh (Fixes #93, Fixes #94, Fixes #81) - #98

Merged
wrong-nebula merged 2 commits into
wrong-nebula:mainfrom
onlinegill:fix/kernel-determinism-and-bounds
Dec 4, 2026
Merged

wrong-nebula merged 2 commits into
wrong-nebula:mainfrom
onlinegill:fix/kernel-determinism-and-bounds

Conversation

@onlinegill

Copy link
Copy Markdown
Contributor

Summary

Fixes three independent forma-core geometry/determinism issues:

1. Reject open_top=true when no flat top face exists (Fixes #93)

  • Updated solidify_mesh (crates/forma-core/src/deform.rs) to track how many top faces were removed when open_top == true. If zero faces matched (sphere(), horizontal cyl(), torus()), returns a clear error (open_top=true found no flat top face to open) instead of silently producing a sealed 2-component hollow shell.

2. Deterministic face & UV ordering in bevel_general_polyhedron (Fixes #94)

  • Sorted adj.edge_faces keys before bridging bevel quads and replaced HashMap with BTreeMap for v_to_faces corner patches (crates/forma-core/src/ops.rs), eliminating HashMap randomization across runs so bevel(all) / bevel(sharp) and downstream unwrap() produce byte-identical outputs.

3. Center voxel grid & snap Y/Z edges in remesh_voxel (Fixes #81)

  • Centered the Surface Nets grid symmetrically on bb.center() (adapting half-cell shift when span < h or boundaries lie near half-integers) and projected triangles onto (x, z) and (x, y) scanlines via a shared project_tri_scanlines helper so Y and Z edge crossings snap to exact triangle intersections just like X edges, eliminating the -0.5 * h Y/Z shift.

Verification

  • Added test_issue_93_open_top_requires_flat_top_face, test_issue_94_bevel_general_polyhedron_is_deterministic, and test_issue_81_remesh_voxel_preserves_center_all_axes in crates/forma-core/tests/kernel_tests.rs.
  • cargo test --locked --release -p forma-core -p forma-lang -p forma-cli -p forma-mcp -p forma-server -- --skip test_10000_fuzzed_modeling_operations_zero_crashes_zero_nans: all passed.

# Conflicts:
#	crates/forma-core/tests/kernel_tests.rs
@wrong-nebula
wrong-nebula merged commit 142cfea into wrong-nebula:main Dec 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants