Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I subdivide a cubic Bézier curve at a given t value using de Casteljau’s algorithm, which yields two cubic Bézier curves. Afterwards I “scale” the second curve (proportionally).

I’d like to reconnect or approximate the two curves to/with a single curve in a third step. Is that possible?

two connected Bézier curves

This illustrates what I’m intending to do.

I guess reversing de Casteljau’s algorithm won’t work because I don’t have one of the intermediate points.

If there are multiple approaches, I’d favor a simpler (faster to compute) strategy.

Thanks in advance.

Update: Maybe this figure makes it more clear; it shows all the points I have: Bézier curves with convex hulls

The original cubic Bézier curve is defined by the points $ p_{0}, p_{1}, p_{2}, p_{3} $.

It is divided at a given $ t $ (timing) value using de Casteljau’s algorithm, which yields the points $ q_{1}, r_{2}, i_{1}, q_{2}, r_{1}, k $ where $ k $ is the division point.

The two subcurves are defined by the control points $ p_{0}, q_{1}, q_{2}, k $ and $ k, r_{1}, r_{2}, p_{3} $, respectively.

The scaled second subcurve is defined by the points $ k, {r}' _{1}, {r}' _{2}, {r}' _{3} $

Scaling is applied as follows: $ {p}' = k + (p - k) \cdot factor $ for $ r_{1}, r_{2}, p_{3} $

share|improve this question
Just to check: you no longer have the convex hulls of any of the two curves you want to splice to a single one? –  J. M. Aug 26 '10 at 0:32
I do have the convex hulls/control points for 1.) the original curve. 2.) the two curves after the split. 3.) and for the “scaled” curve. The second two sets are result of applying De Casteljau’s algorithm to the original curve (there’s also one remaining auxiliary point), while the third set of points is just a scale transformation of the right sub-curve in relation to it’s origin (which is also the end point of the left sub-curve). –  david Aug 26 '10 at 19:21
FWIW, at first glance it seems like the most useful approximation for this problem (since as @DavidCary notes below, there's no exact answer) might be to take the cubic that passes through your two end points (the one that stays the same and the newly-calculated endpoint), and your break point, and that matches one of the three slopes - I'd lean towards the slope at the break point but you could experiment and see which one gives the best results. This is a slightly more complicated cubic, but since you've got 4 parameters you should still be able to match them all. –  Steven Stadnicki Jan 11 '13 at 2:18
add comment

3 Answers

up vote 5 down vote accepted

You probably already know this, but let me explicitly point out:

== exact match ==

It is not possible to construct a single cubic Bezier curve that exactly matches your new curve.

A single cubic Bezier curve has a constant "curvature" A along its length. When you shrink it, the new curve has "sharper" curvature B (but still constant along the length of the new curve).

It is not possible to construct a single cubic Bezier curve -- since, like all single cubic curves, it has constant curvature C along its length -- such that C=A along the part of the length, and C=B along the rest of the length, where A<>B.

(I'm mis-using the term "curvature" here for something that is more precisely the 3rd derivative of a curve, sometimes called the "jerk").

== approximation ==

Perhaps the simplest approximation is: Use the initial starting point and first control knot -- p0 and p1, and the final control knot and final ending point -- r'2 and r'3. Use those 4 points as the start, control knots, and endpoint of a Bezier curve that approximates the one you want: a0, a1, a2, a3.

This approximation exactly hits the endpoints of your desired curve, and has the same initial and final slope at those endpoints, but it slightly diverges from your desired curve in the middle. In particular, it probably doesn't go exactly through the cutpoint K.

There are many other possible approximations you could make. The "Don Lancaster's Guru's Lair Cubic Spline Library" may have the details I'm leaving out:

  • It is possible to nudge a1 along the line p0-p1, or to nudge a2 along the line r'2-r'3 -- or both -- such that the approximation curve not only starts and ends at the same points and slopes, but also passes through the cutpoint K.
  • pick any 4 points along your new curve (perhaps the endpoints, the cutpoint K, and some other point) and generate a cubic Bezier curve that goes exactly through all 4 points.
  • pick many points along your new curve -- bunched together in places where curve matching is important, perhaps near the endpoints and point K, and spaced further apart where curve matching is not so important -- and generate a cubic Bezier curve that is a least-squares best fit to those points.
share|improve this answer
David: +1 ; the term for the third-derivative analog of curvature for curves is "aberrancy": jstor.org/stable/2690245 ("jerk" is the derivative of acceleration ;) ). –  J. M. Sep 4 '10 at 0:44
David, thank you very much for your precise and clear answer. This really helps me. –  david Sep 4 '10 at 10:09
@JM: Yay, I learned a new word today: "aberrancy". Thank you for the link. –  David Cary Sep 8 '10 at 13:46
add comment

As others have pointed out, an exact solution with a single Bezier cubic is not possible.

If you're going to approximate, there are two obvious choices for the approximant:

(1) A single Bezier cubic. I wouldn't expect this to work very well. The approximation error will be larger if the deformation of the sub-curve is significant. In fact, the maximum error will be the maximum of the distances $r_1r_1'$, $r_2r_2'$, $p_3r_3'$.

(2) A cubic spline (i.e. a sequence of Bezier cubics). But, you don't need an approximation process to produce this spline -- you already have a sequence of Bezier cubics, namely the two you got from the de Casteljau subdivision. You can join these two cubics together into a single $C_1$ spline, if you want, but I don't see any great benefit from doing that.

share|improve this answer
add comment

You can calculate the distance of q2 K and k r′1 Mark as LeftLength and RightLength we can image we have got a cubic curve, whick we subdivide at k, but what is the t value? we can calculate t from de Casteljau’s algorithm , that is t = leftLength / rightLength we also knot that the new curve's p1' is along p0->p1 direction, and p2' is along p3->p2, so we can use t to calculate the new curve's p1' and p2'.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.