Skip to content

fix: harden surface nets arithmetic and optimize density smoothing#1

Merged
LachyFS merged 1 commit into
mainfrom
fix/surface-nets-safety
Apr 1, 2026
Merged

fix: harden surface nets arithmetic and optimize density smoothing#1
LachyFS merged 1 commit into
mainfrom
fix/surface-nets-safety

Conversation

@LachyFS

@LachyFS LachyFS commented Apr 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace fragile isize arithmetic in gradient_and_ao_at_cell() with safe coordinate-based usize indexing for 26-neighbor reads
  • Eliminate copy_from_slice and swap in density smoothing by reordering ping-pong passes
  • Make blend_dist configurable via set_blend_dist() (default 4.0)

Test plan

  • cargo test (72/72 pass)
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo check on urath-wasm

- Replace isize arithmetic in gradient_and_ao_at_cell() with safe
  coordinate-based usize indexing for 26-neighbor reads
- Eliminate copy_from_slice and swap in density smoothing by reordering
  ping-pong passes so result lands directly in density
- Make blend_dist configurable via set_blend_dist() (default 4.0)
@LachyFS LachyFS merged commit 7a066ee into main Apr 1, 2026
1 check 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

Development

Successfully merging this pull request may close these issues.

1 participant