Cubic Bézier spline multiple split

bezier-curvegeometryspline

I have a cubic Bézier spline with four points: P1, C1, C2 and P2. I'm using De Casteljau method to split the spline to two parts at a given point x, 0 <= x <= 1.

The question is, can I use the same algorithm to split the spline twice? Say, that I want to split spline in points x1 = 0.25 and x2 = 0.75. First I split the spline S to S1 and S2 at the point 0.25. Next, I re-evaluate x2, since now it's on the segment [0.25, 1]. If I then subtract 0.25 from everything, I get 0.5 on [0, 0.75], which, scaled up to [0, 1] gives me x2'=0.(6). Then I split S2 on point x2 to get another two splines and the center one is the one I'm seeking.

Is the re-calculation of split point on the second spline valid? I mean, will 0.(6) on the second spline will match the original 0.75 on the initial one?

Best Answer

Your approach will work, but you can actually run two instances of the de Casteljau algorithm at the same time, which will save you some computations and make the construction clearer.

The best way to explain this is by using the concept of "blossoming". This was actually the technique used by de Casteljau himself, in the 1960s, though it didn't become popular until much later. Nowadays, it's easy to find descriptions on the internet.

Among other things, blossoming gives us a nice way to label the points that arise during the de Casteljau algorithm. The labels make it clear how the points are calculated as convex combinations of previous ones.

Here is the blossom diagram for a cubic curve, split into three pieces by splitting at the parameter values $a= \tfrac14$ and $b=\tfrac34$.

enter image description here

The original curve has control points $000, 001, 011, 111$.
The first segment has control points $000, 00a, 0aa, aaa$.
The second segment has control points $aaa, aab, abb, bbb$.
The third segment has control points $bbb, bb1, b11, 111$.

All the points in the diagram are computed as convex combinations, so ...

P_00a = (1-a)*P_000 + a*P_001
P_00b = (1-b)*P_000 + b*P_001  
P_01a = (1-a)*P_001 + a*P_011
...
P_0aa = (1-a)*P_00a + a*P_01a 
...

and so on.