f_2pline: 2-dimensional line function

View source: R/curves.R

f_2plineR Documentation

2-dimensional line function

Description

The line connects two points c(x0, y0) and c(x1, y1).

Usage

f_2pline(x0, y0, x1, y1)

Arguments

x0

A numeric value. The x-axis value of the first point.

y0

A numeric value. The y-axis value of the first point.

x1

A numeric value. The x-axis value of the second point.

y1

A numeric value. The y-axis value of the second point.

Examples

xs <- seq(-2, 2, length = 100)
lfun <- f_2pline(1, 1, -1, 5)
plot(lfun(xs), type = "l")
points(1, 1)
points(-1, 5)

lines(f_2pline(1, 1, 2, 1)(xs)) # horizonatal line
lines(f_2pline(1, 1, 1, 2)(xs)) # vertical line doesn't work


DrylandEcology/rSW2utils documentation built on Dec. 9, 2023, 10:44 p.m.