Skip to content

Stage 3b · Phase 1 — geodesic path on a curved profile (VK nosecone, software) #326

Closed

Description

@CameronBrooks11

Stage 3b · Phase 1 — geodesic path on a curved surface (Von Kármán nosecone, software-only). Parent epic: #139.

The first shippable slice of general surfaces of revolution. Adds the first non-developable profile surface and a numeric geodesic path builder, reusing the Stage 3a cone seams. Software-only, zero hardware risk — it proves the geometry end-to-end and produces a planned/simulated/plotted/G-code-exportable VK toolpath with an (expected) bare polar cap near the tip. Full tip coverage is Phase 2 (#327).

Refined 2026-08-08 after a full code-map + numeric validation + 4-critic adversarial assessment. Detailed plan (rev 2): working/vk-phase1-plan.md, posted as a comment below. The bullets here reflect the refined decisions.

Why this is unblocked

The Stage 3a cone survey shows the seams are surface-agnostic: lower_developed_path makes no developability assumption; _validate_coverage is surface-independent; dispatch is two isinstance ladders. The one genuine new piece is a numeric Clairaut quadrature replacing the cone's closed-form θ(z) (a cone unrolls flat; a VK profile does not):

θ(z) = ∫ C / ( r(z)·√(r(z)² − C²) ) · √(1 + r′(z)²) dz ,   C = R·sin α

Scope (refined)

  • Surface — VonKarman{length} in planning/surface.py, base radius from mandrelParameters.diameter/2 (no separate baseDiameter — it would duplicate diameter). Provides radius_at, radius_slope_at (analytic r′, cancelled closed form), is_developable() → False (first such). VK LD-Haack: θ_p=arccos(2z/L−1), r=(R·π^-0.5)·√(θ_p−sin2θ_p/2), base at z=0.
  • Kinematics — generic compute_profile_helical_kinematics + profile_geodesic_theta_deg + profile_local_alpha_deg in calculations.py. Numeric θ on a fine fixed grid (~0.1 mm, error budget ≤1e-3° at the cap) → cumulative table, interpolated at the ~1 mm emitted stations. No math.sqrt( token (CI single-source guard pins it to metrics.py): use math.hypot, ((r−C)*(r+C))**0.5, **0.5. Mandatory domain clamps (arccos arg to [−1,1]; max(0,·) before **0.5).
  • Reachability / polar cap — the geodesic can't cross r=C, so every VK helical leaves a bare cap; the validator reports it (does not reject on the cap). Report both 2C and the actual 2·r(z_cap). Reject only an unusable wound band (min(windLength,z_cap) ≤ lead_in or C ≥ R). z_cap floored to the integer station lattice + a boundary-clearance assertion so the cross-platform len(moves) gate can't flip.
  • Builder — build_profile_helical_developed_path (cone-builder structure, θ/α from the profile sources, pass end = min(windLength, z_cap)); reuse lower_developed_path untouched. Uniform ~1 mm emitted stations (chord error accepted for Phase 1).
  • Validator + dispatch — validate_profile_helical_layer; hoop-on-VK rejected, skip allowed. Dispatch the numeric path on not surface.is_developable(); end both ladders exhaustively; build the per-layer mandrel re-wrap with model_copy(update=…).
  • .wind — additive discriminated mandrelParameters.profile = {type:"vonKarman", length}, schemaVersion 1.2 (already allowed by ^1\.\d+$). model_validator rejects profile + endDiameter both-set → WindFileError (parse-time; not a bare ValueError). Regenerate wind-schema.json + openapi.json + TS types (drift gates). Wind-format doc + changelog + a "known approximations" note (base-radius metrics on curved surfaces).
  • GUI guard — the GUI plans/saves from a reserialized model and silently strips unmodelled mandrel fields (see gui: cone endDiameter silently stripped on open/plan/save (.wind 1.1 data loss) #344). Add a blocking guard: refuse to plan/save a loaded .wind carrying mandrel fields the model can't represent (covers endDiameter + profile). Full GUI editing → gui: edit/round-trip mandrelParameters.profile (Von Kármán) in the project model #345.
  • Example + tests — examples/vk_nosecone/ (equivalence-gated, no expected.gcode, like the cone). Conformance valid + enumerated invalid fixtures (both-set, unusable-band) with exact match substrings. See the plan's §4 test matrix (differential integrator oracle, derivative-vs-finite-diff, table-interpolation, non-circular IR-delta geometry check + negatives, example-driven assert_profile_*, in-process IR round-trip).

Definition of done

A .wind file with a VK profile plans a helical layer and emits Marlin G-code, gated by the equivalence harness (Clairaut geometry re-derived from the emitted IR + integer len(moves) structural gate), with the bare-cap diameter surfaced to the user (G-code comment + kinematics field). All existing cylinder/cone goldens stay byte-identical. No friction model, no new hardware axis.

Delivery

Ships as 3 sequential PRs: (1) surface + integrator (isolated math), (2) builder + validator + equivalence harness (internal VonKarman driver), (3) .wind field + dispatch + example + conformance + docs + regenerated artifacts + the GUI guard.

Explicitly out of scope (later)

See docs/development/roadmap.md (Stage 3b) and the feasibility assessment on #139.

Activity

  1. added
    enhancement
    python
    on Jun 30, 2026
  2. added
    gui
    on Aug 8, 2026
  3. CameronBrooks11 commented on Aug 8, 2026

    @CameronBrooks11
    MemberAuthor

    Implementation plan (rev 2) — post-assessment

    Produced from a full code map (geometry core / schema+format / test architecture) + independent numeric validation, then hardened by a 4-critic adversarial assessment (2026-08-08). The body checklist above reflects these decisions; this comment records the reasoning so it survives.

    Key corrections the assessment caught

    • Integrator accuracy was misquoted. The differential oracle's 3.4e-5° was at 0.09 mm steps, not 1 mm; at a true 1 mm step the cone-limit error is ~4e-3° (worse near the cap), and per-station θ error accumulates into the mandrel angle. ⇒ integrate on a fine fixed grid (~0.1 mm, budget ≤1e-3° at the cap) decoupled from the ~1 mm emitted lay stations.
    • r′(z) needs the cancelled closed form −(2R·π^-0.5/L)·sinθ_p/√(θ_p−sin2θ_p/2) — the naive chain rule is 0/0 at the base (z=0, first grid point). Grid built strictly on [0, z_cap] (r′ diverges at the tip).
    • Mandatory domain clamps: arccos arg to [−1,1]; max(0,·) before **0.5 (a tiny negative base to **0.5 returns a silent complex in Python).
    • The Clairaut invariant is tautological (α≡asin(C/r)); the real geometry oracle re-derives the local angle from consecutive emitted-IR deltas (tan α_emp = r·Δθ/(√(1+r′²)·Δz)) and the differential integrator-vs-cone test. Surface test uses literature-pinned reference values, not the same formula twice.
    • len(moves) integer gate is the cross-platform lock — protected by flooring z_cap to the 1 mm station lattice + a boundary-clearance assertion (transcendental compares differ by ulps across the 3-OS libm matrix).

    Decisions

    1. Reject profile+endDiameter both-set at a pydantic model_validator → WindFileError (parse-time; API 422; conformance-catchable). A bare ValueError in surface_from_mandrel would be a 500 and escape the conformance raises((WindFileError, PlanningError)).
    2. No baseDiameter on the profile — base radius comes from mandrelParameters.diameter/2 (avoids desyncing the machine/metrics that read diameter).
    3. Generic profile machinery, VonKarman concrete surface; dispatch the numeric path on not surface.is_developable() (extensible to domes, gives the flag a real consumer).
    4. Wound band = min(windLength, z_cap) — one value feeds both the builder pass end and _validate_coverage.
    5. Cap reporting = G-code comment + a cap_diameter field on the kinematics (report 2C and the actual 2·r(z_cap)); a structured warnings field is a noted optional upgrade.
    6. GUI: a blocking guard (refuse to plan/save a file with mandrel fields the model can't represent — covers endDiameter + profile). Full editing → gui: edit/round-trip mandrelParameters.profile (Von Kármán) in the project model #345; the pre-existing cone endDiameter data loss → gui: cone endDiameter silently stripped on open/plan/save (.wind 1.1 data loss) #344.

    Slicing (3 sequential PRs)

    1. Surface + numeric integrator (isolated math; differential oracle incl. near-cap, derivative-vs-finite-diff, table-interpolation).
    2. Builder + validator + equivalence harness (internal VonKarman driver; harness re-derives r(z)/√(1+r′²) inline + negative tests incl. "θ table missing the meridian factor must fail"). No dispatch wiring yet (would be dead code without the schema field).
    3. .wind field + dispatch + example + conformance (enumerated invalid fixtures) + example-driven assert_profile_* + in-process IR round-trip + docs/regen + GUI guard.

    Full working plan: working/vk-phase1-plan.md (local).

  4. CameronBrooks11 commented on Oct 19, 2026

    @CameronBrooks11
    MemberAuthor

    The local working/vk-phase1-plan.md referenced above is gone. Its decisions are in this thread, its two follow-ups are #344 and #345, and its test strategy shipped as tests/planning/test_profile.py and the _equivalence.py profile checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementguipython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions