pointssegment: Interpolates between two points

Description Usage Arguments Details Value See Also Examples

View source: R/pointssegment.r

Description

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

Usage

1
2
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.

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.

Value

A data frame with the interpolated values.

See Also

jitter

Examples

1
2
3
4
5
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))

xkcd documentation built on May 2, 2019, 4:47 p.m.