R: Functions to perform polar coordinate related functions
polar2xy
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.
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))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ecolitk)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ecolitk/polar2xy.Rd_%03d_medium.png", width=480, height=480)
> ### Name: polar2xy
> ### Title: Functions to perform polar coordinate related functions
> ### Aliases: polar2xy xy2polar rotate
> ### Keywords: manip
>
> ### ** 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))
>
>
>
>
>
>
> dev.off()
null device
1
>