I can draw a spline through 10 successive points, like done in this post
set.seed(1)
n <- 10
x <- runif(n)
y <- runif(n)
p <- cbind(x,y)
xlim <- c(min(x) - 0.1*diff(range(x)), c(max(x) + 0.1*diff(range(x))))
ylim <- c(min(y) - 0.1*diff(range(y)), c(max(y) + 0.1*diff(range(y))))
plot(p, xlim=xlim, ylim=ylim)
text(p, labels=seq(n), pos=3)
xspline(x, y, shape = c(0,rep(-1, 10-2),0), border="red")
But is it possible to force the direction of the line in each point to be at a specific heading? - For examle if the heading was 0 in point #2, it would be forces to go straight up, and not as now in a north-easterly direction.
Like on a compass: 0=north, 90=east, 180=south and 270=west.
For example you could use the following 10 headings:
h <- round(runif(n, min = 0, max = 359),0)
Also, the output should be able to be saved as a spatial line.