Learn R Programming

xkcd (version 0.0.3)

pointssegment: Interpolates between two points

Description

This function calculates intermediate points between two points. The intermidate points can be jittered and smoothed with a Bezier curve.

Usage

pointssegment(xbegin, ybegin, xend, yend,
              npoints = 10, xjitteramount= 0, yjitteramount=0, bezier = TRUE)

Arguments

xbegin
A numeric value. Coordinate x of the point from which to interpolate.
ybegin
A numeric value. Coordinate y of the point from which to interpolate.
xend
A numeric value. Coordinate x of the point to which to interpolate.
yend
A numeric value. Coordinate y of the point to which to interpolate.
npoints
Number of points (including the limits).
xjitteramount, yjitteramount
Numeric. Amount of jitter.
bezier
Logical. Use or not the Bezier curves to smooth the jittered data.

Value

  • A data frame with the interpolated values.

Details

It calculates the intermediate points between two points. If there are no jitter amounts, then there are no interpolations.

By default, the data are smoothed using a Bezier curve. It gives 30 points.

See Also

jitter

Examples

Run this code
plot(pointssegment(xbegin=0, ybegin=0, xend=10, yend=10))
plot(pointssegment(xbegin=0, ybegin=0, xend=10, yend=10,
                   xjitteramount=2,yjitteramount=2))
plot(pointssegment(xbegin=0, ybegin=0, xend=10, yend=10,
                   xjitteramount=2,yjitteramount=2,bezier=FALSE))

Run the code above in your browser using DataLab