pol2car {frechet} | R Documentation |
Transform polar to Cartesian coordinates
Description
Transform polar to Cartesian coordinates
Usage
pol2car(p)
Arguments
p |
A vector of length d (d≥2) with the first element being the radius and the others being the angles,
where p[2] takes values in [0,2π] and p[i] takes values in [−π/2,π/2] , for all i>2 if any.
|
Value
A vector of length d
holding the corresponding Cartesian coordinates
(r∏i=1d−1cosθi,rsinθ1∏i=2d−1cosθi,rsinθ2∏i=3d−1cosθi,…,rsinθd−2cosθd−1,rsinθd−1),
where r
is given by p[1]
and θi
is given by p[i+1]
for i=1,…,d−1
.
Examples
pol2car(c(1, 0, pi/4)) # should equal c(1,0,1)/sqrt(2)
pol2car(c(1, pi, 0)) # should equal c(-1,0,0)
[Package
frechet version 0.3.0
Index]