Bezier Curves

LinearB[p0_, p1_, t_] := (1- t) p0 + t p1;
QuadraticB[p0_, p1_, p2_, t_] :=(1-t) LinearB[p0, p1, t] + t LinearB[p1, p2, t];
CubicB[p0_, p1_, p2_, p3_, t_] := (1-t) QuadraticB[p0, p1, p2, t] + t QuadraticB[p1, p2, p3, t];

ShowQB[p0_, p1_, p2_] := Module[{P}, 
P = ParametricPlot[Evaluate[QuadraticB[p0, p1,p2, t]],{t,0,1},PlotRange-> 3, PlotStyle -> Thick];
Show[P, Graphics[{Red, Line[{p0, p1, p2}]}]]
]

ShowCB[p0_, p1_, p2_, p3_] := Module[{P}, 
P = ParametricPlot[Evaluate[CubicB[p0, p1,p2, p3, t]],{t,0,1},PlotRange-> 3, PlotStyle -> {Thick, Green}];
Show[P, Graphics[{Red, Line[{p0, p1, p2, p3}]}]]
]

CubicB[{0,0}, {1, 1}, {1, 2}, {2, 1}, t]

Manipulate[ShowQB[p0, p1, p2],{{p0,{0,0}},Locator}, {{p1,{1,1}},Locator},{{p2,{2,2}},Locator}, SaveDefinitions->True]

Manipulate[ShowCB[p0, p1, p2, p3],{{p0,{0,0}},Locator}, {{p1,{1,1}},Locator},{{p2,{2,2}},Locator}, {{p3,{3,3}},Locator}, SaveDefinitions->True]

Manipulate[Show[ShowCB[p0, p1, p2, p3], ShowQB[p0, p1, p2], ShowQB[p1, p2, p3]],{{p0,{0,0}},Locator}, {{p1,{1,1}},Locator},{{p2,{2,2}},Locator}, {{p3,{3,3}},Locator}, SaveDefinitions->True]

C1 = Expand[QuadraticB[{0,0}, {1, 0}, {1, 1}, t]]
C2 = Expand[QuadraticB[{-3,2}, {-2, 0}, {0, 0}, t]]

D[C1, {t, 2}]
D[C2, {t, 2}]

Show[ ParametricPlot[ Evaluate[QuadraticB[{0,0}, {1, 0}, {1, 1}, t]], {t, 0, 1}, Axes -> None, PlotStyle-> {Thick, Blue}, PlotRange -> All],  ParametricPlot[ Evaluate[QuadraticB[{-3,2}, {-2, 0}, {0, 0}, t]], {t, 0, 1}, Axes -> None, PlotStyle-> {Thick, Blue}]]

Bezier Patches

BasicPatch[ p00_, p10_, p01_, p11_, u_, v_] := (1 - v) LinearB[p00, p10, u] + v LinearB[p01, p11, u];

Manipulate[ParametricPlot3D[Evaluate[BasicPatch[{0,0,0}, {1, 0, 0}, {0, 1, 0}, {x, y, z}, u, v]], {u, 0, 1}, {v, 0, 1}, BoundaryStyle -> {Thick, Red}, PlotRange -> {0, 2}], {x, 0, 1.5}, {y, 0, 1.5}, {z, 0, 1.5}]

Bern[n_, i_, u_] := Binomial[n, i-1] u^(i-1) (1 - u)^(n-i+1);

BiQuadBezierPatch[A_, u_, v_] := Plus @@ Flatten[ MapIndexed[ Bern[2, #2[[1]], u] Bern[2, #2[[2]], v] #1 &, A, {2}], 1]

A = {{ {0, 0, 0}, {1, 0, -1}, {2, 0, 0}}, {{0, 1, -1}, {-1, 1,-2}, {2, 1, -1}}, 
{{0, 2, 0}, {1, 2, 2}, {2, 2, 0}}};

r = Expand[Evaluate[BiQuadBezierPatch[A, u, v]]]

Show[ParametricPlot3D[Evaluate[r], {u, 0, 1}, {v, 0, 1}, PlotRange -> {-1, 2.5}], Graphics3D[{Red, Thick} ~Join~ Map[Point, Flatten[A, 1]]]]