Write a program to compute a Bezier curve in two segments such that the curve is continuously differentiable between the segments. Use the program to draw the letter "S" as two letter "C"s.
I draw the letter "S" as two letter "C"s in the domain [0,1]*[0,2]. For the upper "C", I chose the control points at (0,2) and (0,1); and for the lower "C", I chose the control points at (1,1) and (1,0). The two segments meet at (0.5,1). Since the endpoints for each segments and the chosen control points satisfy that $x_i-x_{i-1/3}=-x_i+x_{i+1/3}$. The curve is shown in Figure 1.
clear all;
close all;
M = [-1 3 -3 1;
3 -6 3 0;
-3 3 0 0;
1 0 0 0];
t = linspace(0,1,1000);
x1 = [1,0,0,0.5;
2,2,1,1];
x2 = [0.5,1,1,0;
1,1,0,0];
T = [t.^3;t.^2;t;ones(size(t))];
B1 = x1*M*T;
B2 = x2*M*T;
set(gca,'XTick',0:.1:1);
plot(B1(1,:),B1(2,:),'ro-');hold on;
plot(B2(1,:),B2(2,:),'bo-')