# How to create an adjustable Bézier curve?

I tried to create an adjustable Bézier curve with the following simple code. However the curve didn't show up. What is the problem? Please help.

pts = {{0, 0}, {1, 2}, {2, 0}, {3, 3}};
bez = BezierFunction[pts ];

Manipulate[
Show[Graphics[{Red, Point[lo], Green, Line[lo]}, Axes -> True],
ParametricPlot[bez[lo ], {t, 0, 1}], ImageSize -> { 200, 200 }],
{{lo, pts}, Locator}
]


-
Works perfectly with me: "10.0 for Microsoft Windows (64-bit) (June 29, 2014)". – eldo Sep 1 '14 at 3:46

Perhaps more compact:

Manipulate[
ParametricPlot[BezierFunction[lo]@t, {t, 0, 1}, Epilog -> {Green, Line[lo]}],
{{lo, pts}, Locator},
Initialization :> (pts = {{0, 0}, {1, 2}, {2, 0}, {3, 3}})]


-
yes much better...was just being lazy but hopefully helpful – ubpdqn Sep 1 '14 at 4:24
Thank you so much. – Putterboy Sep 1 '14 at 7:02

I believe this should achieve your aim:

Manipulate[
bez = BezierFunction[lo];
Show[Graphics[{Red, Point[lo], Green, Line[lo]}, Axes -> True],
ParametricPlot[bez[t], {t, 0, 1}],
ImageSize -> {200, 200}], {{lo, pts}, Locator},
Initialization :> (pts = {{0, 0}, {1, 2}, {2, 0}, {3, 3}};)]


Quit kernel and try. Note: (i) the dynamic variable is the lo. pts are merely initial configuration (ii) the Bezier function $bez: [0,1]\mapsto R^2$-> t not lo as argument.

-
+1 for hopefully helpful :) – Dr. belisarius Sep 1 '14 at 4:24