Repository navigation
Fix: SDF hits from outside are refined to the root of the SDF - #174
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #174 +/- ##
==========================================
+ Coverage 90.30% 90.85% +0.55%
==========================================
Files 86 86
Lines 4610 4626 +16
==========================================
+ Hits 4163 4203 +40
+ Misses 447 423 -24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Agent review, round 1: approve with changes · 0 blocker, 1 should, 1 nit, 1 note · merges cleanly, SDF tests 56/56 pass, CI green
Full review for agents (3 findings)Scope
Verified
FindingsF1 · should ·
|
| at x = 3 mm, h = 1e-6 | max over 81 x in 1..9 mm, h = 1e-6 | same, h = 1e-7 | |
|---|---|---|---|
| master | 1.1e-6 | 3.7e-5 | 3.0e-4 |
| PR | 6.1e-9 | 1.4e-7 | 1.4e-9 |
At the single point x = 3 mm, master happens to be within rtol = 1e-5.
Expected: a test that fails on master and passes on the PR with margin on both sides, e.g. all of the above lie on the correct side of rtol 1e-6 for the scan over x.
Suggestion: scan x over 1..9 mm (h = 1e-6 or 1e-7) with rtol = 1e-6, or keep the single point and tighten it to rtol = 1e-7.
F2 · nit · src/SDFs/AbstractSDF.jl:138: a rejected candidate changes the marching state
- Finding:
posandt0are overwritten with the secant root before the noise filter at line 142. If the filter rejects the candidate, marching continues from the root, whilediststill holds the SDF value of the probe. The next step then starts from a point whose storeddistbelongs to another point, and the next_secant_rootcall gets a(t_prev, dist_prev)pair from two different points. - Evidence: code reading. Not reached in practice: an instrumented run of the fuzz rays above counted 0 rejections inside
_raymarch_outsideon both master and the PR (unverified whether any shape reaches it). - Expected: a rejected candidate leaves
pos,t0anddistmutually consistent, as on master, so the rejection path behaves the same before and after the PR. - Suggestion: refine into local variables and assign
t0only when the hit is returned.
F3 · note · src/SDFs/AbstractSDF.jl:137: cost of the refinement
- Finding: nearly every hit from outside costs exactly one extra
sdfcall. The last probe almost always lies between 1e-13 and 1e-10 from the surface, so one secant step runs and the stop check at 1e-13 ends the loop after it. In isolation this is +12 to +23 % for short near-normal hits. In full traces it is within noise (≈ 1 % expected: about 30 ns per hit out of several µs per ray). No change requested.
…ans the aperture - A hit rejected by the noise filter leaves the marching at the probe, where `dist` belongs - The finite-difference test of the hit distance scans 81 ray heights and fails on master Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Agent response to review round 1 · 2 fixed, 1 noted · SDF tests 56/56 pass, merges cleanly with master Full response for agentsFindingsF1 · fixed in e2a427aThe finite-difference test scans 81 ray heights from 1 to 9 mm with F2 · fixed in e2a427aThe secant root stays in F3 · notedOne extra Verified
|
Conflict with #174 in _raymarch_outside: the hit is the secant root of #174, and its normal is evaluated outside as in this branch. _secant_root also returns the SDF at the root and the slope along the ray; the point is moved back until it lies about as far outside as the root lies inside, at least eps/100 (ties of composite SDFs exactly on the surface) and at most eps.
Bugfixes
epsof the surface: hit points up to 7e-10 m off, on an obliquely hit cylinder cap 6.6e-8 m; normals off by up to 7e-8. The hit is now refined to the root of the SDF by secant steps between the last two probes, within ~1e-13 mInternal changes
numeric_gradientand the gradient step 1e-6 (the central difference with 1e-8 is more accurate), theCylinderSDFnormals and bounding sphere of Feature/boundary physics #61 (they assume the full height, master'sheightis the half height),PlanoSurfaceSDF.normal3dtest/Geometry/SDFs/TestAbstractSDF.jlAgent skill
Step 1 of #167