This works (SplineDegree -> 2)
ParametricPlot[BezierFunction[{{0, 0}, {1, 0.5}, {2, 2}}, SplineDegree -> 2][u], {u, 0, 1}]

but this does not (SplineDegree -> 1)
ParametricPlot[BezierFunction[{{0, 0}, {1, 0.5}, {2, 2}}, SplineDegree -> 1][u], {u, 0, 1}]
BezierFunction::invdeg: Value of option SplineDegree -> 1 should be a positive integer, or a list of positive integers
I found no reference to a possible issue in the documentation for BezierFunction.
SplineDegree -> 1 works fine with BSplineFunction and BezierCurve; shouldn't it also work with BezierFunction?
(Mma 8.0.4 Mac OSX)
Answer
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
BezierCurveeither.
So, we decided not to support it.
SplineDegree->1case: Just useBSplineFunction. It is exactly the same parametrization, running between 0 to 1, uniformly divided by the number of line segments.SplineDegree->dwhered > 1:CompositeBezierFunctioncode will be provided.
Comments
Post a Comment