Files
solvecraft/solidcore/plan/findings/surface.surface_p8--notes.md
Brennen Herbruck 916b91e8d0 Vendor solidcore at solidcore/ with its history (solidcore c0d3cc0124)
solidcore's main at c0d3cc0124, rewritten to one commit per same-author run per
PR (2,800 commits, author credit kept; tree identical). Full original history:
tangency-labs/solidcore archive/full-history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

git-subtree-dir: solidcore
git-subtree-mainline: 44525da669
git-subtree-split: c440e5f892
2026-11-08 15:18:40 -05:00

4.3 KiB
Vendored

surface.surface_p8

  • GlobalPointSolve_0 wired (review of PR #118). Surface::global_point_solve_0 takes the kernel and the surface's handle (surface: O, as GlobalLineIntersect does), builds the cache and runs SpGlobalSolver with local_solve_branch; Surface::global_point_solve gained surface: Option<O> (None for callers without a handle, which then cannot maximize) and the out-parameter form global_point_solve_into. SpGlobalSolver::may_contain_answers reads the cache through the solver's surface_cache (no sm_IsNodeValid gap left).
  • Statics only Rust-tested. extract_iso_curve (sm_ExtractIsoCurve) and intersect_srf_bndry_crv (sm_IntersectSrfBndryCrv) are file-local statics of SmSurface.cpp that cannot be linked; they are covered by Rust unit tests and will be exercised through LiftCurve / the surface intersector (surface.surface_p11, intersect.surface_intersector_*).
  • Blend rails that are SmLine (disagreement, not fixed). CreateBlendSurface(.., line rail, ..): C++ differs from the port from the second cross section on (e.g. line (1.595, 1.519, -0.110) to (-1.564, -0.859, -1.738), interval [0, 4.276], B-spline rail on [0, 1], plane and surface of revolution: C++ point (-1.78, -1.02, -1.85) at u = 0.25, Rust (0.81, 0.92, -0.52)). The same line as a B-spline gives identical results. Suspected cause: SmLine::GetNaturalInterval returns the analytic domain until SyncronizeKnotsOfCurves creates the NURB (SmLine.cpp:796), so the rail intervals used to remap the intersection parameters differ; the port's line rail is its base B-spline. The FFI guard rejects line rails for the blend op and the generator avoids them; Curve/Line ops with line curves compare fine.
  • Plane line-intersect fallback (review of PR #118, fixed). SmPlane::GlobalLineIntersect for a line in the plane whose clipped ends have the same line parameter (SM_ARE_SAME(tStart, tEnd): a tiny domain or a huge line vector) calls SmSurface::GlobalLineIntersect on the plane. Probe: plane o=0, n=z, op=line, dom=[0,0,1e-9,1e-9], p=0, v=(1e6,1e6,0), tol=1e-6: the second solution's value was C++ 7.071067811865476e-10, Rust 6.585445079827193e-10 (and t -5.0e-16 against -4.657e-16; with dom=1e-10 the solution counts differed, 28 against 41 values). Cause: the leaf solve's boundary solves build SmIsoCurve(*pSrfEval, ..) over the plane (SmSurface.cpp:18568, :18696), and SmIsoCurve::Evaluate calls the surface's virtual Evaluate, i.e. SmPlane's analytic one; surface::surface::p9::implicit_iso built it over the plane's NURB, whose bilinear interpolation over the +-1234567 analytic domain rounds at the ulp of 1e6 (the closest point of the line to a domain corner moved by 2^-31). A flat B-spline of the same size agreed because C++ evaluates it through the NURB too. implicit_iso now builds the iso curve over the plane itself (IsoCurve::from_surface). Coverage: fixtures/surface.surface_p8/plane_line_fallback.json (54 cases: tiny domains 1e-10..2e-6, line vectors along an axis, diagonal and anti-diagonal, with and without interval and ray, tilted plane); all agree. The remaining SmIsoCurve gap over a plane in surface::surface::p5 / p6 (iso_curve_of, boundary_iso_curve, see surface.surface_p5 above) is unchanged.
  • Cache cost at tiny scale (HANG-15): generated surfaces start at scale 1e-3. The case that seemed to hang (GlobalCurveIntersect, 5 x 6 net of scale 1e-4, sliver domain) is not an infinite loop: SubdivideToTolerances stops only at the minimum side ratio, which absolute tolerances make unreachable for such a net; the C++ takes 15 s, the port 121 s. The bound is the cache's existing subdivision limit (MAX_SUBDIVISION_DEPTH).
  • CreateBlendSurface heap corruption (UB-157): see plan/upstream-issues.md; the shim probes it and the port returns InvalidInput.
  • Unwired by this unit: SmSurface::DropCurve (intersect.surface_drop_lib_p3). smsurf_CheckShapeMatch (surface.surface_p3, merged) and the stale surface.surface_p6 stubs in surface::surface::p10 (LocalCurveIntersect, ClassifyIntersectingRangeSolution) are wired. The 373 deferred cases left all name surface.surface_point_solve_p3 (GlobalPointSolve_1, LocalPointSolve_1). topology::loopuse still has its own UNPORTED(surface.surface_p5) DropPoint stub (not this unit's code).