I realise lots of questions and answers exists on the use of B-splines in R, but I have yet to find an answer to this (seemingly simple) question.
Given a set of points that describe a control path, how do you fit a B-spline curve to that and extract a given number of points (say 100), along the curve for plotting. The catch is that the path is not monotonous in neither x, nor y.
An example control path:
path <- data.frame(
x = c(3, 3.5, 4.6875, 9.625, 5.5625, 19.62109375, 33.6796875, 40.546875, 36.59375, 34.5, 33.5, 33),
y = c(0, 1, 4, 5, 6, 8, 7, 6, 5, 2, 1, 0)
)
I've mainly looked at the splines
package but again, most examples has been regarding fitting a smooth curve to data. For context, I'm looking at implementing hierarchical edge bundling in R.