hn.today

Slightly Better Interpolating Spline

gasiulis.name8 points1 comments
Screenshot of Slightly Better Interpolating Spline

S9 is an interpolating spline designed to produce naturally rounded, smooth shapes while remaining predictable when users move knots in interactive CAD tools. Its central argument is that manually adjusting Bézier handles across many connected curves is unreliable: people struggle to judge subtle curvature changes, and changing one part of a polynomial curve can affect curvature elsewhere. A good spline should therefore automate smoothness both within segments and across their joins. S9’s priorities include making round forms easy to create, avoiding curvature spikes between knots, responding smoothly to edits, limiting unwanted inflections, and allowing at most one inflection per segment.

The spline is curvature-continuous at knots, or G2 continuous, and connects knots with non-polynomial curves based on the Cesàro equation. Its method resembles Hobby spline: first construct a segment from its endpoint tangent angles, then use a global solver to adjust tangent angles until neighboring segments’ curvatures match. The key innovation is the segment curve and its automatically computed weights. These control how curvature changes, ranging from linear variation to sharper turns; when both weights equal one, the curve is an Euler spiral. The author reports lower curvature variation and better roundness than most comparable splines for a broader range of inputs, while noting that large tangent angles can still produce high-curvature spikes near segment ends. The supplied implementation covers the curve and spline solvers, not a complete CAD path system; features such as sharp corners and straight-to-curve transitions require separate additions.

Read on gasiulis.name1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.