source("http://macosa.dima.unige.it/R/curve.txt")
source("http://macosa.dima.unige.it/R/bezier.txt")
# o: source("http://macosa.dima.unige.it/R/r1.R")
box(-3,3,-3,3)
x1 <- c(-3,-1,1,3,3)
y1 <- c(0,-2,2,0,-2)
bezier(x1,y1,3)
bezier(x1,y1,0)

box(-4,4,-4,4)
a <- c(-3,2,2,-1)
b <- c(2,1,-3,4)
bezier(a,b,2)
bezier(a,b,0)

box(-4,4,-4,4)
x2 <- c(-1, -2,- 3,- 3,-2, -1, 0,  1, 2, 3, 3,  2, 1)
y2 <- c(-2,-1.5,-1, 1, 2, 2.5,2.6,2.5,2, 1,-1,-1.5,-2)
box(-3,3,-3,3)
bezier(x2,y2,0)
x3 <- c(0,1,2,3,2, 0, -2,-3,-2, 0, 2,3,2, 0, -2,-3,-2,-1,0)
y3 <- c(-4,-4,-2,-1,-1/2,0,1/2,1,2,4,2,1,1/2,0,-1/2,-1,-2,-4,-4)
box(-4,4,-4,4)
bezier(x3,y3,0)

xx <- c(-1,-1,0,0,1,1)
yy <- c(0,1,1,-1,-1,0)
boxm(-1,1,-1,1)
bezier(xx,yy,0); bezier(xx,-yy,0)

xx <- c(   0,  -1, -3, -4,   -4,   -3,  -1,  0,   1,    3,   4,  4,   3,  1,    0)
yy <- c(0.43,0.43,0.2,0.1,0.001,0.005,0.02,1.8,0.02,0.005,0.001,0.1,0.2,0.43,0.43)
xxx <- c(-2,-2,0,2,2)
yyy <- c(0.26,-0.26,0.26,-0.26,0.26)
xxxx <- c(-1/2,-1/2,0,1/2,1/2)
yyyy <- c(0,0.3,0,0.3,0)
box(-3.5,3.5, 0,0.5)
bezier(xx,yy,"red"); bezier(xxx,yyy,1); bezier(xxxx,yyyy,"brown")