Skip to content

feat(charts): smooth lines render as native cubic Beziers via PathNode#170

Merged
DemchaAV merged 3 commits into
developfrom
feat/chart-bezier-smooth
Jun 12, 2026
Merged

feat(charts): smooth lines render as native cubic Beziers via PathNode#170
DemchaAV merged 3 commits into
developfrom
feat/chart-bezier-smooth

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

What

W3 — the payoff of the path workstream (#168 primitive, #169 DSL): ChartSpec.line().smooth(true) stops tessellating.

  • LineChartLayout drops the fixed 8-sub-segment Catmull-Rom sampler entirely: a smooth run (3+ points) compiles into one stroked PathNode with Catmull-Rom-derived Bézier control points (c1 = p1 + (p2−p0)/6, c2 = p2 − (p3−p1)/6 — the exact continuous curve the sampler approximated). Native PDF curveTo operators, zero facets at any zoom, and fewer content-stream ops than the old 8×N segments.
  • Smooth area fills close the very same curve down to the baseline — fill and stroke edges coincide instead of a tessellated polygon hiding under a sampled stroke.
  • Two-point runs stay straight segments; non-smooth charts untouched — all committed chart snapshot baselines pass unchanged.

Verification

  • Resolver tests rewritten/added: one-native-Bézier-run (segment count + cubic types + stroke/fill split), curved-area shape (moveTo + 2 cubics + 2 baseline edges + close), two-point fallback, one-point smooth+area edge case still green.
  • ChartLayoutSnapshotTest (committed baselines) green without re-baselining.
  • Regenerated chart-showcase.pdf + feature-catalog.pdf previews; the smooth-area page eyeballed — perfectly smooth, fill hugs the stroke.
  • Full gate: ./mvnw verify -pl . — see commit; BUILD SUCCESS.

DemchaAV added 3 commits June 12, 2026 01:45
W3 of the path workstream: LineChartLayout drops the fixed 8-sub-segment Catmull-Rom sampler entirely - smooth runs (3+ points) compile into one stroked PathNode per run with Catmull-Rom-derived Bezier control points (c1 = p1 + (p2-p0)/6, c2 = p2 - (p3-p1)/6, the exact continuous curve the sampler approximated), and smooth area fills close the very same curve down to the baseline so fill and stroke edges coincide. Two-point runs stay straight segments; non-smooth charts are untouched (committed snapshot baselines unaffected - verified, all chart snapshot tests green). Resolver tests rewritten: one-native-run, curved-area shape, two-point fallback. Regenerated chart-showcase and feature-catalog previews - the smooth page now has zero facets.
…ooth z-order assertion, build() reuse contract
@DemchaAV DemchaAV merged commit 2052cf7 into develop Jun 12, 2026
11 checks passed
@DemchaAV DemchaAV deleted the feat/chart-bezier-smooth branch June 12, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant