>    restart;
BezierCurve := proc()
  local fp,filename,i,j,N,x,y,xt,yt,X,Y,C,P,t;
  with(plots);
  printf("***** Author: Mengnien Wu ***********************\n");
  printf("* Draw a picture composed of N Bezier curves.   *\n");
  printf("* A file which contains                         *\n");
  printf("*    N                                          *\n");
  printf("*    x[  1 ] y[  1 ] xt[  1 ] yt[  1 ]          *\n");
  printf("*    x[  2 ] y[  2 ] xt[  2 ] yt[  2 ]          *\n");
  printf("*        :       :        :        :            *\n");
  printf("*        :       :        :        :            *\n");
  printf("*    x[2N-1] y[2N-1] xt[2N-1] yt[2N-1]          *\n");
  printf("*    x[ 2N ] y[ 2N ] xt[ 2N ] yt[ 2N ]          *\n");
  printf("* will be read, where (xt,yt) is the derivative *\n");
  printf("* of (x,y) wrt parameter t.                     *\n");
  printf("*************************************************\n");
  printf("\nEnter your filename:\n");

  filename := scanf("%a")[1];
  fp:=fopen(filename,READ);
    N :=fscanf(fp,"%d")[1];
    x :=array(1..2*N); y :=array(1..2*N);
    xt:=array(1..2*N); yt:=array(1..2*N);
    for i from 1 to 2*N do
      x[i] :=fscanf(fp,"%f")[1];
      y[i] :=fscanf(fp,"%f")[1];
      xt[i]:=fscanf(fp,"%f")[1];
      yt[i]:=fscanf(fp,"%f")[1];
    od;
  fclose(fp);

  C:=array(1..N);
  for i from 1 to N do
    X:=x[2*i-1]+ t*( xt[2*i-1]
       + t*( 3*(x[2*i]-x[2*i-1])-2*xt[2*i-1]-xt[2*i]
       + t*(xt[2*i-1]+xt[2*i]-2*(x[2*i]-x[2*i-1])) ) );  
    Y:=y[2*i-1]+ t*( yt[2*i-1]
       + t*( 3*(y[2*i]-y[2*i-1])-2*yt[2*i-1]-yt[2*i]
       + t*(yt[2*i-1]+yt[2*i]-2*(y[2*i]-y[2*i-1])) ) );  
    C[i]:=plot([X,Y,t=0..1],color=blue,scaling=constrained):
  od;
  P := plot([[x[n],y[n]] $n=1..2*N],style=point,symbol=circle):
  display( P,[ C[n]$n=1..N ] );
end:

>    BezierCurve();

***** Author: Mengnien Wu ***********************
* Draw a picture composed of N Bezier curves.   *
* A file which contains                         *
*    N                                          *
*    x[  1 ] y[  1 ] xt[  1 ] yt[  1 ]          *
*    x[  2 ] y[  2 ] xt[  2 ] yt[  2 ]          *
*        :       :        :        :            *
*        :       :        :        :            *
*    x[2N-1] y[2N-1] xt[2N-1] yt[2N-1]          *
*    x[ 2N ] y[ 2N ] xt[ 2N ] yt[ 2N ]          *
* will be read, where (xt,yt) is the derivative *
* of (x,y) wrt parameter t.                     *
*************************************************

Enter your filename:

>    "BezierHead.txt"

[Maple Plot]

>    BezierCurve();

***** Author: Mengnien Wu ***********************
* Draw a picture composed of N Bezier curves.   *
* A file which contains                         *
*    N                                          *
*    x[  1 ] y[  1 ] xt[  1 ] yt[  1 ]          *
*    x[  2 ] y[  2 ] xt[  2 ] yt[  2 ]          *
*        :       :        :        :            *
*        :       :        :        :            *
*    x[2N-1] y[2N-1] xt[2N-1] yt[2N-1]          *
*    x[ 2N ] y[ 2N ] xt[ 2N ] yt[ 2N ]          *
* will be read, where (xt,yt) is the derivative *
* of (x,y) wrt parameter t.                     *
*************************************************

Enter your filename:

>    "BezierPicachu.txt"

[Maple Plot]

>