2
$\begingroup$

I can generate the same Bézier Curve using my own code as the curve generated by Mathematica's function BezierCurve, but when I increased the order of the curve, it seems the graph I generated seems different from the one Mathematica generated.

I did it according to the definition of the Bézier curve, I do not know why. Can somebody explain it to me?

pointsGeneration[k_] := RandomReal[10, {k, 2}];
parametricterms[n_, x_,l_List]:=(Binomial[n-1,Prepend[Range[n-1],0]] Table[x^i (1-x)^(n-1-i),{i,0,n-1}]).l;
a = pointsGeneration[5];
cc = parametricterms[5, x, a];
ParametricPlot[{cc[[1]], cc[[2]]}, {x, 0, 1}, AxesOrigin -> {0, 0}];
Graphics[BezierCurve[a], Axes -> True, AxesOrigin -> {0, 0}]
$\endgroup$
5
$\begingroup$

Options[BezierCurve] contains SplineDegree -> Automatic which seems to split a list of control points {c1,c2,c3,c4,c5,c6,c7,c8,c9} into {c1,c2,c3,c4}, {c4,c5,c6,c7} and {c7,c8,c9} so you get continuously joined cubic beziers except for the last part whose degree depends on the number of supplied control points.

Your code makes the same curve as

Graphics[BezierCurve[a], SplineDegree -> Length[a] - 1, Axes -> True, AxesOrigin -> {0, 0}]
$\endgroup$
  • $\begingroup$ So, are my codes working correctly when the order is higher according to the definition of bezier curve? $\endgroup$ – Chonglin Zhu Dec 19 '18 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.