Find spaced Points along a line
find evenly spaced points along a line
PointsAlong(x, y, spacing = NULL, N = 1, endtol = 0.1)
x
: x-coordinatesy
: y-coordinatesspacing
: spacing of pointsN
: number of pointsendtol
: indent on either endsThe total length is returned: this is the line integral along the trace.
List: - x: x-coordinates
y: y-coordinates
rot: angle at the points
TOT: total length along the trace
Jonathan M. Lees<jonathan.lees@unc.edu
plot(c(-5,5), c(-5,5), asp=1, type='n' ) ff=list() ff$x=c(-4.850,-4.700,-3.934,-2.528, 0.603, 2.647, 3.861, 2.626) ff$y=c(-4.045,-2.087,-0.710, 0.172, 1.291, 2.087,-0.753,-4.131) g = PointsAlong(ff$x, ff$y, N=20) lines(ff$x, ff$y) points(g$x, g$y)
Useful links