Reason for incompatibility
Yes, the doc shouldn't mention that it is fully compatible (that's an oversight...). BSplineFunction
and BSplineCurve
are fully compatible as far as I remember, but not BezierCurve
and BezierFunction
.
The reason is that what BezierCurve
is doing when it has more than d+1
control points for SplineDegree->d
case is something called composite Bezier curve. Essentially, the remainder of control points are grouped in d
points, and creating degree d
spline by carrying the last point from the previous curve.
pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, 2}, {6, -1}, {7, 3}, {8, -1}, {9, 1}, {10, -2}};
Graphics[{BezierCurve[pts], Green, Line[pts], Red, Point[pts]}]
It is a convenient hack that graphics / CAD people has been using for a long time, and it makes sense when you are creating multiple continuous curve segments.
But the problem with it for BezierFunction
is that:
it does not guarantee the continuous derivative at the connection points (which are marked with blue circles). It only guarantees $C^0$:
Another problem is parametrization. Should parameters run between 0 to 1 (by uniformly dividing by the number of curve segments), or what... None of this is a problem for graphics primitives.
This idea is not working well in multi-dimensional case (it can be extended, but no one uses it and has no mathematical meaning).
There are few mathematical ways to make the connection $C^d$ when $d$ is the degree, nonetheless (introducing intermediate control points or using smoothing function), but then it is not matching with
BezierCurve
either.
So, we decided not to support it.
Work around
SplineDegree->1
case: Just useBSplineFunction
. It is exactly the same parametrization, even derivatives arerunning between 0 to 1, uniformly divided by the samenumber of line segments.SplineDegree->d
whered > 1
:CompositeBezierFunction
code will be provided.