polar2xy: Functions to perform polar coordinate related functions

Description Usage Arguments Details Examples

View source: R/rotate.R

Description

Functions to perform polar coordinate related functions

Usage

1
2
3
polar2xy(rho, theta)
xy2polar(x, y)
rotate(x, y, alpha)

Arguments

x

cartesian coordinate

y

cartesian coordinate

rho

polar radius rho

theta

polar angle theta

alpha

angle to perform rotation

Details

y and theta can be respectively missing. In this case, x and rho are expected to be lists with entries x, y, rho, theta respectively.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n <- 40
nn <- 2
thetas <- seq(0, nn * 2 * pi, length=n)

rhos <- seq(1, n) / n

plot(c(-1, 1), c(-1, 1), type="n")
abline(h=0, col="grey")
abline(v=0, col="grey")

xy <- polar2xy(rhos, thetas)

points(xy$x, xy$y, col=rainbow(n))

ecolitk documentation built on Nov. 8, 2020, 5:29 p.m.