polar2xy {ecolitk} | R Documentation

## Functions to perform polar coordinate related functions

### Description

Functions to perform polar coordinate related functions

### Usage

    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.

### Value

### Examples

    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))

[Package Contents]