Conversion between angular and Cartesian coordinates of the (hyper)sphere
Conversion between angular and Cartesian coordinates of the (hyper)sphere
Transforms the angles (θ1,…,θp−1)′ in [0,π)p−2×[−π,π) into the Cartesian coordinates [REMOVE_ME](cos(x1),sin(x1)cos(x2),…,sin(x1)⋯sin(xp−2)cos(xp−1),sin(x1)⋯sin(xp−2)sin(xp−1))′[REMOVEME2]
of Sp−1, and vice versa.
angles_to_sphere(theta)sphere_to_angles(x)
Arguments
theta: matrix of size c(n, p - 1) with the angles.
x: matrix of size c(n, p) with the Cartesian coordinates. Assumed to be of unit norm by rows.
Returns
For angles_to_sphere, the matrix x. For sphere_to_angles, the matrix theta.
Description
Transforms the angles (θ1,…,θp−1)′ in [0,π)p−2×[−π,π) into the Cartesian coordinates