Urgent.News

What's breaking now, across thousands of outlets.

Tech

Slightly better interpolating spline

I am pleased to present a new interpolating spline named S9. To gain a clearer understanding, you can interact with knots and manipulate the spline using the provided demo. A comparison with other splines is also available. The source code for this implementation can be found in the linked repository.

For years, manual manipulation of cubic Bézier points has been the norm. While experienced designers may employ certain rules, they are only applicable if no alternative solution exists. Human beings struggle to create visually appealing sequences of curves due to the difficulty in discerning subtle curvature variations. The key to understanding curvature lies in the concept of the osculating circle, which approximates how a curve bends at any given point.

By examining the reciprocal of the osculating circle radius, we can visualize the curvature profile of a curve. A smoother plot indicates a smoother curve, while a more intricate plot suggests greater curvature variation. Ideally, the curvature variation should be minimal, as represented by a red plot closely aligned with a horizontal grey line. Perfect curvature variation can be seen in the case of a circular segment, where the red function's integral equals zero.

When connecting multiple curves, the goal is to maintain smoothness within individual segments and continuity between curves. This becomes increasingly complex as the number of curves increases, as polynomial curves exhibit a property where altering one side affects the curvature on the other side. Splines address this issue, ensuring automatic smoothness and continuity in interactive CAD applications.

The primary objective of S9 is to produce aesthetically pleasing and smooth round objects. Currently, few splines are optimized for this purpose. The best G2-continuous interpolating spline is noted for its use of a single cubic curve to connect knots. Another contender is κ-Curves, implemented in Adobe Illustrator's Curvature tool, but it has limitations with solver failures.

Hobby spline, an older option, lacks G2 continuity but boasts a simpler solver. Apple Keynote and other applications utilize this spline. More renowned splines like Catmull-Rom have use cases but lack relevance in serious CAD applications.

S9's development follows a similar path to Hobby spline, with two main components. The solver part functions well but requires creating a curve parameterized by two angles, a challenging task. The curve itself is defined as a function of arc length, leveraging Greek letter symbolism in the implementation provided by the Desmos graphing calculator.

The source repository contains both the curve solver and spline solver. However, it is not intended as a comprehensive path construction solution for CAD applications. It does not include G2-continuous transitions from straight to curved segments, sharp corners, or angle locking features.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at gasiulis.name →

More in Tech

More from Monday 9 November →