# How to construct BezierFunction for BezierCurve with npts>4 and SplineDegree -> 3?

I would like to use BezierCurve with npts=7 and SplineDegree -> 3 and access its BezierFunction. This code helps:

pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {5, 2}, {6, -1}, {7, 3}};
f1 = BezierFunction[pts[[1;;4]]]
f2 = BezierFunction[pts[[4;;7]]]
Show[Graphics[{Red, Point[pts], Green, Line[pts]}, Axes -> True],
ParametricPlot[{f1[t],f2[t]}, {t, 0, 1}],Graphics[{Blue, Dashed,
BezierCurve[pts, SplineDegree -> 3]}]]


Can it be done better, defining f as a single function, whose plot is BezierCurve?

(1) Partition pts into blocks of 4 with offset 3,

(2) Use BezierFunction on each block and

(3) To get a single function, compose Through with the list of Bezier functions.

pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {5, 2}, {6, -1}, {7, 3}};
f0 = Through @* (BezierFunction /@ Partition[pts, 4, 3]);

Show[Graphics[{Red, Point[pts], Green, Line[pts]}, Axes -> True],
ParametricPlot[f0[t], {t, 0, 1}, PlotStyle -> Directive[Opacity[.7, Red], Thickness[.01]]],
Graphics[{Blue, Dashed, BezierCurve[pts, SplineDegree -> 3]}]]


• Perfect! Many thanks. – Igor Aug 5 '19 at 16:35
• Igor, you are welcome. And welcome to mma.se. Please consider upvoting (by clicking the triangles) the questions/answers you like and accepting the answer, if any, that solves your problem, by clicking the checkmark sign. – kglr Aug 5 '19 at 17:03