I asked this question at StackOverFlow, but got no answers, so I thought I would try here also:
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 example, if the heading was 0 in point #2, it would be forced to go straight up, and not as now in a north-easterly direction.
Like on a compass:
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.