Skip to content

fix: 4D negative-orientation cell during batch construction (88% vertex skip rate) #307

@acgetchell

Description

@acgetchell

Summary

During 4D 100-point batch construction, a cell (CellKey(29v7), vertices [6v1, 2v1, 9v1, 11v1, 7v1]) is created with orientation=-1 (negative geometric orientation). This cell persists throughout construction and causes 88 of 100 subsequent vertex insertions to be skipped as degeneracies.

Reproducer

DELAUNAY_LARGE_DEBUG_N_4D=100 DELAUNAY_LARGE_DEBUG_ALLOW_SKIPS=1 \
  cargo test --release --test large_scale_debug debug_large_scale_4d \
  -- --ignored --nocapture
  • Seed: 0x9B7786C999C56A16, ball distribution (radius=100)
  • Only 12 of 100 vertices inserted (12% success rate)
  • All 88 skips hit the same cell with orientation=-1
  • The resulting 12-vertex triangulation passes L1–L4 validation
  • In debug mode, PLManifoldStrict validation produces ~250+ identical warnings for this cell at ~2s intervals, causing extreme slowness that looks like a hang

Root Cause Hypothesis

The cell is created during Bowyer-Watson cavity filling without proper orientation normalization. In 3D, orientation is canonicalized post-insertion (cells are reordered to positive orientation), but the 4D path may be missing this normalization step.

Investigation Steps

  1. Trace cell creation: determine which insertion index first creates CellKey(29v7) with negative orientation
  2. Check if orientation normalization (normalize_cell_orientation or equivalent) is applied in the 4D cavity-filling code path
  3. Compare the 3D and 4D orientation normalization paths for discrepancies

Fix Strategy

Ensure orientation normalization is applied to all newly created cells in the cavity-filling code, regardless of dimension. This should be straightforward if the normalization exists for 3D but is missing or conditional for 4D.

Secondary Issue: Debug-Mode Warning Spam

The negative-orientation cell causes PLManifoldStrict validation to emit ~250+ identical warnings. Consider rate-limiting or deduplicating these warnings to prevent debug-mode runs from appearing hung.

References

Co-Authored-By: Oz oz-agent@warp.dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions