back

by raphlinus·7y ago·view on hn ↗
It's likely it could be reworked to not make those spikes. The reason it happens is tricky. The basic curve family (what you get when you don't add explicit tangents) has a π-periodicity in the angles. Essentially it cares about the slope of the tangent but not the signed direction, and reverses the sign as needed. The curvature blending uses the same family but the sign reversals don't always "make sense" in terms of producing a smooth result. It's not obvious it would be better, as what you'd get would be more "twisty," and it's also possible the twistiness would snap as you rotated the handles. So making a direction reversal might be one of the less visually objectionable ways to handle the problem.

This is one of those "deep UX" questions I find fascinating.

2 comments
When the bar is turned through 360 degrees its adjustment effect seems to go through 2 complete cycles. A single ended adjustment line which begins perpendicular in a default orientation and goes through just 1 complete adjustment cycle when turned 360 might be easier to control and understand, even though it would be less like the familiar bezier tweak lines.
This spline only depends on the orientation of the tangent line, not on the direction of the tangent ray. i.e. it is periodic every half turn, as you found.

That’s actually the whole point of this type of curve (and also Adobe’s recent “k-curve” tool) – knots are more or less at the curvature extremes; pulling a knot outward will make first a ruffle shape, then a sharp cusp, then a loop; the curve in general doesn’t extend far outside the rough shape of a polygon through the knots; and the solver is robust.

There exist plenty of curve primitives more like what you are suggesting here (see Raph’s PhD thesis), with a full-turn periodicity. But they end up creating shapes which loop out past the knots, and they also tend to not have unique solutions all the time, with the result that they sometimes will discretely jump from one local minimum to another as you make slight changes in the inputs.

> There exist plenty of curve primitives more like what you are suggesting here.

The only thing difference I suggest is the control. Its the difference between:

effect = control_angle mod PI ,or

effect = control_angle / 2

When a full turn of the control produces a full cycle of effect a better ergonomic relationship might result.

Yes, but the generated shapes are based on the curve primitives used. The whole point of this particular curve primitive is that the “default” shape of the spline (if you don’t try to set the tangents explicitly) doesn’t extend much past the knots, because of the half-turn periodicity. As you drag a knot away from the spline, you will get a cusp shape with the knot at the cusp, and if you drag further it will turn into a loop with the knot at the peak of the loop.

If you instead had a full-turn periodicity, you would have substantially different properties for the curve shape. Several such curve primitives exist, you can use one of those if you want. This is one of the trade-offs involved in the choice of tool.

With this particular type of curve primitive, the primary way to change the spline is by adding and moving control points, not by trying to manually specify tangents. The latter should not be used for general shape design but should be seen as a specialty tool to support niche technical requirements (such as straight segment to curve interfaces), and tangent adjustments should be sparing because large tangent adjustments will create lumpy shapes.

Sorry I dont share your idea of correctness between this control parameter and its formulaic effect. We might say the formula naturally wraps this angle, but the formula doesn't mind what space we prefer to map from.

> If you instead had a full-turn periodicity, you would have substantially different properties for the curve shape

We would have precisely the same effect on curve shape from a 360 degree control than with a wrapped 180 degree control, but have twice as much travel to adjust the outcome more finely.

Makes sense. Personally, I like it, though it does make the curve slightly less predictable.