New independent API (fit_tolerance.h/.cpp), no existing behavior touched:
- fit_curve_to_tolerance(points, tol, options): chord parameters, initial
uniform clamped LSQ fit, measured closest-point error via existing
curve_closest_point, parameter refinement (strictly decreasing only), knot
insertion at the max-error location until tolerance met or iteration /
control-point limit; honest ok=false + diagnostic otherwise.
- fit_surface_to_tolerance(grid, tol, options): tensor-product LSQ with
measured closest-point error via NurbsSurface::closest_point_param,
per-direction insertion, same honest stopping rules.
- reverse pruning: remove_knot / reduce_degree_curve / surface_remove_knot
candidates accepted only when re-measured error stays within tolerance.
- error metric never under-reports: min(closest-point API distance,
known-fit-parameter evaluate distance); both are genuine distances. For
large point sets, a known-parameter distance <= tolerance is a provable
per-point acceptance test and skips the expensive projection (early-skip).
- performance: initial control-point caps 128 (curve) / 64 per direction
(surface); 10000-point curve 219.1 s -> 1.37 s (112 CP), 101x101 grid
131.6 s -> 0.03 s (17x25 CP net).
Tests: tests/curves/test_fit_tolerance.cpp (19 cases: curve 12 + surface 7),
registered in tests/curves/CMakeLists.txt. Full suite 19/19; ctest
-R "Curves|Nurbs|Fit|Surface" 21/21; gated [CBRA] 18-line baseline
byte-identical (2344 B, raw SHA256 b3acddc6...e2c). WIP notes in
docs/planning/wave3/nurbs-notes.md.
Existing API behavior unchanged (only 2 CMake registration lines added to
existing files).