Learn R Programming

GEOmap (version 2.1)

PointsAlong: Find spaced Points along a line

Description

find evenly spaced points along a line

Usage

PointsAlong(x, y, spacing = NULL, N = 1, endtol = 0.1)

Arguments

x
x-coordinates
y
y-coordinates
spacing
spacing of points
N
number of points
endtol
indent on either ends

Value

  • List:
  • xx-coordinates
  • yy-coordinates
  • rotangle at the points
  • TOTtotal length along the trace

Details

The total length is returned: this is the line integral along the trace.

Examples

Run this code
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)

Run the code above in your browser using DataLab