Cartesian to polar coordinate conversion.

cartesian2polar(x, y = NULL)

Arguments

x

x coordinate (or a vector of length 2 holding \(x, y\))

y

y coordinate

Value

A list of the \(r\) and \(phi\) polar coordinates.

See also

Examples

cartesian2polar(0, 0)
#> $r #> [1] 0 #> #> $phi #> [1] 0 #>
cartesian2polar(1, 2)
#> $r #> [1] 2.236068 #> #> $phi #> [1] 1.107149 #>
cartesian2polar(c(1, 2))
#> $r #> [1] 2.236068 #> #> $phi #> [1] 1.107149 #>