Skip to main content
deleted 31 characters in body; added 74 characters in body
Source Link
Yu-Sung Chang
  • 7.1k
  • 1
  • 39
  • 31

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]}]

composite bezier

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.

not c1

But the problem with it for BezierFunction is that:

  1. it does not guarantee the continuous derivative at the connection points (which are marked with blue circles). It only guarantees $C^0$:

  2. 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.

  3. This idea is not working well in multi-dimensional case (it can be extended, but no one uses it and has no mathematical meaning).

  4. 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

  1. SplineDegree->1 case: Just use BSplineFunction. It is exactly the same parametrization, even derivatives arerunning between 0 to 1, uniformly divided by the samenumber of line segments.

  2. SplineDegree->d where d > 1: CompositeBezierFunction code will be provided.

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]}]

composite bezier

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.

not c1

But the problem with it for BezierFunction is that:

  1. it does not guarantee the continuous derivative at the connection points (which are marked with blue circles). It only guarantees $C^0$:

  2. 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.

  3. This idea is not working well in multi-dimensional case (it can be extended, but no one uses it and has no mathematical meaning).

  4. 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

  1. SplineDegree->1 case: Just use BSplineFunction. It is exactly the same parametrization, even derivatives are the same.

  2. SplineDegree->d where d > 1: CompositeBezierFunction code will be provided.

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]}]

composite bezier

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.

not c1

But the problem with it for BezierFunction is that:

  1. it does not guarantee the continuous derivative at the connection points (which are marked with blue circles). It only guarantees $C^0$:

  2. 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.

  3. This idea is not working well in multi-dimensional case (it can be extended, but no one uses it and has no mathematical meaning).

  4. 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

  1. SplineDegree->1 case: Just use BSplineFunction. It is exactly the same parametrization, running between 0 to 1, uniformly divided by the number of line segments.

  2. SplineDegree->d where d > 1: CompositeBezierFunction code will be provided.

Source Link
Yu-Sung Chang
  • 7.1k
  • 1
  • 39
  • 31

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]}]

composite bezier

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.

not c1

But the problem with it for BezierFunction is that:

  1. it does not guarantee the continuous derivative at the connection points (which are marked with blue circles). It only guarantees $C^0$:

  2. 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.

  3. This idea is not working well in multi-dimensional case (it can be extended, but no one uses it and has no mathematical meaning).

  4. 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

  1. SplineDegree->1 case: Just use BSplineFunction. It is exactly the same parametrization, even derivatives are the same.

  2. SplineDegree->d where d > 1: CompositeBezierFunction code will be provided.