# pol2cart: pol2cart In useful: A Collection of Handy, Useful Functions

## Description

Converts polar coordinates to cartesian coordinates

## Usage

 `1` ```pol2cart(r, theta, degrees = FALSE) ```

## Arguments

 `r` The radius of the point `theta` The angle of the point, in radians `degrees` Logical indicating if theta is specified in degrees

## Details

Converts polar coordinates to cartesian coordinates using a simple conversion. The angle, `theta` must be in radians.

Somewhat inspired by http://www.r-bloggers.com/convert-polar-coordinates-to-cartesian/ and https://www.mathsisfun.com/polar-cartesian-coordinates.html

## Value

A data.frame holding the (x,y) coordinates and original polar coordinates

Jared P. Lander

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```polarRadPosTop <- data.frame(r=c(3, 5, 3, 5, 4, 6, 4, 6, 2), theta=c(0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi)) polarRadPosBottom <- data.frame(r=c(3, 5, 3, 5, 4, 6, 4, 6, 2), theta=c(pi, 7*pi/6, 5*pi/4, 4*pi/3, 3*pi/2, 5*pi/3, 7*pi/4, 9*pi/6, 2*pi)) polarRadNegTop <- data.frame(r=c(3, 5, 3, 5, 4, 6, 4, 6, 2), theta=-1*c(0, pi/6, pi/4, pi/3, pi/2, 2*pi/3, 3*pi/4, 5*pi/6, pi)) polarRadNegBottom <- data.frame(r=c(3, 5, 3, 5, 4, 6, 4, 6, 2), theta=-1*c(pi, 7*pi/6, 5*pi/4, 4*pi/3, 3*pi/2, 5*pi/3, 7*pi/4, 9*pi/6, 2*pi)) pol2cart(polarRadPosTop\$r, polarRadPosTop\$theta) pol2cart(polarRadPosBottom\$r, polarRadPosBottom\$theta) pol2cart(polarRadNegTop\$r, polarRadNegTop\$theta) pol2cart(polarRadNegBottom\$r, polarRadNegBottom\$theta) ```

useful documentation built on Oct. 8, 2018, 5:04 p.m.