f_circle: Circle function with angle argument 'theta'

View source: R/curves.R

f_circleR Documentation

Circle function with angle argument theta

Description

Circle function with angle argument theta such that sign(dir) * theta + theta0 = 0 corresponds to c(x0 + r, y0)

Usage

f_circle(x0 = 0, y0 = 0, r = 1, theta0 = 0, dir = 1)

Arguments

x0

A numeric value. The x-axis value of the circle center.

y0

A numeric value. The y-axis value of the circle center.

r

A numeric value. The circle radius.

theta0

A numeric value. The (anti-clockwise) angle/rotation of the starting point of the circle.

dir

A numeric value, interpreted as either -1, i.e., clockwise, or as 1, i.e., anti-clockwise direction.

Examples

thetas <- seq(0, 2 * pi, length = 200)
# circle with radius 1 and center at 0/0
circle1 <- f_circle()
plot(circle1(thetas), asp = 1, type = "l")
points(0, 0, pch = 4)
# circle with radius 0.1 and center at 0.3/0.3
lines(f_circle(0.3, 0.3, 0.1)(thetas))
# circle with radius 0.1 and center at -0.3/0.3
lines(f_circle(-0.3, 0.3, 0.1)(thetas))
# semi-circle with radius 0.5 and center at 0/0
lines(f_circle(0, 0, 0.5, dir = -1)(seq(0, pi, length = 200)))


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