Skip to content

Comment on Curvature Beziers: Improving on a timeless recipeparent

Comments

Oh Béziers are great and not going anywhere, and I’m not suggesting they should. It’s all about your specific goals. I think B-splines are misunderstood and underutilized, and your comment might be exemplifying that a little. ;) For one, Catmull-Rom is not a B-spline. For two, it’s easy to achieve local control of a B-spline wherever it’s needed (there are two separate ways to do this). For three, and most importantly - note that the goal of the article is to get a smooth join, and the technique in the article is to drop localized control (!) by imposing constraints on both sides of a join point. Using a Bézier for this is more complicated than using a B-spline, for no additional benefit that I can see. Also worth mentioning that uniform B-splines and Béziers are mathematically shape equivalent - it’s trivial to convert between them, so they provide identical levels of control, they’re just slightly different interfaces for the same shape.

Minor edit here to note, it just occurred to me that the curvature constraint affects the curve over a span of 7 control points, whereas editing a B-spline control point affects the curve over a span of 4 control points. B-splines are strictly more localized than Curvature Béziers…

One reason B-splines aren’t well known & used is because seemingly most/all online content launches into the math and discussion of knots. The uniform B-spline doesn’t need knots, and I wish more tutorials would start there rather than intimidating people with the math.

BTW yes you’re right about the ‘scalars’ (the beta parameters) in the G2 curvature matching equation. I haven’t tried this and I don’t know what they do. I was wondering if these might have a relationship to the ‘heuristic’ the Acko article derives? That was kind of my question.

I wrote the article :).

To clarify, I meant B-splines _lack local control_ like Catmull-Rom splines, not that the latter is an instance of the former. Though indeed, all cubic splines are just cubic polynomials.

I disagree with your characterization that the proposed solution lacks local control, because edits only affect the segments in question, just like with a classic bezier. From the point of view of curvature handles, the handles you don't touch don't change. (The splitting of a curvature bezier is imo the best illustration of this.)

Re: the meaning of the scalars, I imagine they are derived similarly as the perpendicular-distance diagram in the post. If you plug bezier formulas into curvature formulas, a lot of terms cancel out.

Ah hehe gotcha, I missed you’re author, and you were saying CatRom and B-splines have similar locality. I feel like talking about local control’s a bit iffy. In a spline with multiple cubic segments, I think a control point edit is going to affect about the same span of arc length with all three bases Bézier, CatRom, and B-spline, no?

My claim that the Curvature Bézier has less locality, of course, was based only on editing one of the Bézier’s shared join points. When you edit a shared point’s position (by moving an anchor) or tangent (by moving either of the interior control points), you are affecting 2 segments, not just one, hence the 7 control point span. I’m being a bit sloppy but I’m sure you understand what I mean there - the portion of curve affected by a single control point edit technically affects a section of the curve that’s fully determined by exactly 7 consecutive control points. (Assuming cubic!)

Re-thinking B-spline, I believe I goofed - editing a control point affect 4 consecutive curve segments, which is the non-locality you’re referring to, but which is also a span of 7 control points, so very similar to editing one of the constrained Bézier’s shared anchor points. The window of which 7 control points slides smoothly with B-spline: the edited control point is the middle of the 7 control point span. With a curvature-constrained Bézier, each shared anchor and its two surrounding control points affect the curve defined by the same 7 control points.

So yes cubic Bézier segments that aren’t constrained in any way (i.e., the “cusp” and “corner” types), sure those have a kind of ‘locality’ in that editing the two interior control points affects only the 1 segment defined by 4 control points. But as soon as you add constraints on the tangents, neighboring segments affect each other, and your control naturally becomes less ‘local’, right?

So anyway, given that adding constraints to Bézier splines will cause neighbors to affect each other and control point edits are no longer confined to a single segment, are there other reasons to stick with Bézier?

Sorry but you're missing the forest for the trees here.

The locality of a bezier, even with symmetric constraints, amounts to the fact that the user's specified positions (the endpoints) and tangent directions are preserved exactly and can be modified independently. This makes detailed edits easy. And because curvature beziers only differ from classic beziers in the tangent lengths (not directions), the same properties hold.

The "7 control point span" you talk about is really a 5 point span, because adjusting the lengths of the bezier tangents at the far ends serves to explicitly preserve the user's intent, namely the radius of curvature.

Catmull-Rom e.g. ties together the tangent at a control point with the position of the previous and next control point. And B-splines don't guarantee going through any control point at all except the endpoints, with the tangents not even independently controllable.

This is why artists like beziers.

It is likely I’m missing something, that’s why I’m asking. ;) I don’t have any experience with curvature Béziers. I don’t understand what you mean about the 5 point span, could you elaborate? With a symmetric tangent Bézier constraint, adjusting either a shared anchor, or adjusting a tangent direction or length, will result in some amount of non-zero movement in two Bézier segments, not one, right? I believe a curvature preserving constraint will do exactly the same, no? Preserving the user’s curvature intent across Bézier segments anchors is a worthwhile goal, but that does come at the cost of always modifying two Bézier segments at a time, doesn’t it? Are you suggesting that meeting the user’s curvature intent across segments doesn’t affect spline locality? And BTW we are talking about spline locality, right? I should have asked for clarification earlier. Control points within in a Bézier segment don’t have any locality, technically; move one and the entire segment must be recomputed. This is how I ended up at 7 control points - it’s all 4 control points of 2 consecutive segments with 1 shared anchor. I don’t understand how an edit to a cubic Bézier spline could correspond to a 5 point span.

It’s true B-splines are approximating and Béziers are considered interpolating (even though 50% of the control points are approximating), and that very well might be the primary or even only reason to choose Bézier for many design goals. It’s also true that with uniform B-splines you can choose to interpolate any given control point at the small cost of duplicating control points (and of course non-uniform B-splines have additional ways).

My only observation, of course, is just that B-splines have the built-in property that curvature is smooth across segments, so if that’s your main goal for a given task, they seem like a decent choice if you can accept the tradeoffs. It is, of course, possible to mix and match curve types.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.