feat(cam-lower): typed + windowed PathEval curvature surface #118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patman/curvature-sups"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
SE(3) S-c. curvature_bounds() raw (f64,f64,f64) -> typed CurvatureSups struct; piece_windows(); blend_kappa_third_sup (CurvatureThird producer, S5 recommended: symbolic dense-sampled, revisable); seam_kappa_second_jump_sum. Behavior-preserving: golden value pins the refactored kappa-second sup; MVT-based FD dominance check with zero slack. Opus review PASS after C1/C2.
Stack step S-c of the SE(3) angular lowering design (docs/superpowers/se3-lowering-design.md sections 3.2, 3.3a and 7). Behaviour-preserving for the translational certificate. - curvature_bounds() now returns a typed CurvatureSups { kappa, kappa_rate, kappa_second, kappa_third } instead of a raw (f64, f64, f64). lower_core unwraps at the r4_sup call site, which is otherwise untouched. - piece_windows() gives per-piece curvature sups paired with the piece's s-range, and curvature_bounds() is now literally the max-fold over it (one source of truth, no second implementation to drift). - blend_kappa_third_sup: the producer CurvatureThird did not have. Mirrors blend_kappa_second_sup one derivative up on the same 1024-sample sweep, differencing at interval midpoints so the second difference stays centred on the non-uniform arc-length grid. The shared sweep and the 'max + half the largest adjacent change' margin rule are factored out. - seam_kappa_second_jump_sum(): 2 * sum over blends of sup|kappa''|, the angular certificate's Peano jump term. kappa'' jumps at every host/blend seam (a host has kappa'' == 0), which is why this term has no translational sibling. Behaviour preservation is pinned from two directions, because neither test alone is enough. typed_curvature_bounds_match_the_legacy_raw_fold compares against a transcription of the pre-typed fold, which pins the fold structure (iteration order, per-kind dispatch, the pieces/entries index correspondence, newtype round-trip) but CANNOT pin the per-blend helpers, since both sides call the same ones -- and this change is exactly what refactored blend_kappa_second_sup's internals. So blend_kappa_second_sup_matches_its_golden_value pins that helper with a hardcoded number; if it ever needs updating, that is the alarm working. blend_kappa_third_sup is cross-checked against a second central difference of kappa' in arc length, which by the divided-difference mean value theorem is a genuine sample of kappa''' for any step size. The reference is deliberately coarse so it biases low, which lets the assertion be 'sup >= measured' with no slack on the unsound side; the non-vacuity slack sits on the other comparison. DECISIONS (Patrick-revisable; recorded because he may come back to them): S5 -- implemented the design doc's recommended option: a symbolic, dense-sampled kappa''' sup mirroring the merged blend_kappa_second_sup heuristic. The logged alternative is to bound TV(zeta) by dense-sampling zeta itself, needing only kappa'' and counting jumps automatically -- one term instead of two, and no fourth-order finite difference. The recorded trigger for falling back is kappa''' sampling proving numerically noisy on real blends; on the rounded-rect fixtures here it is not. Revisit if stiffer geometry says otherwise. S6 -- implemented the design doc's recommended per-piece (windowed) sup accumulation, which is what piece_windows() exists for. It is applied to the angular certificate only; the translational certificate keeps its pass-wide sup, since changing a merged pinned bound is out of scope here. Applying the same windowing translationally is a contained, strictly-tightening follow-up. Co-authored-by: patman-assist <patrick-ai@kgroo.co>