# simulate doctor's signature ;)
set.seed(71);
xy=matrix(rnorm(16), ncol=2)
tp=seq(0,1,len=301)
doc_signtr=bcurve(xy)
plot(doc_signtr(tp), t="l", xaxt='n', yaxt='n', ann=FALSE, frame.plot=FALSE,
xlim=range(xy[,1]), ylim=range(xy[,2]))
# see where control points are
text(xy, labels=seq(nrow(xy)), col=rgb(0, 0, 0, 0.25))
# join them by segments
lines(bcurve(xy, n=1)(tp), col=rgb(0, 0, 1, 0.25))
# randomly curved wire in 3D space
if (FALSE) {
if (requireNamespace("rgl", quietly=TRUE)) {
xyz=matrix(rnorm(24),ncol=3)
tp=seq(0,1,len=201)
curv3d=bcurve(xyz)
rgl::plot3d(curv3d(tp), t="l", decorate=FALSE)
}
}
Run the code above in your browser using DataLab