powered by
This function converts spherical coordinates (theta, phi) to Cartesian coordinates.
spherical_to_cartesian(theta_phi, byrow = TRUE)
A matrix where each row contains the Cartesian coordinates (x, y, z) of a point.
A matrix where each row contains the spherical coordinates (theta, phi) of a point.
logical. If TRUE (the default) the matrix is filled by rows, otherwise the matrix is filled by columns.
theta_phi <- matrix(c(pi/4, pi/3, pi/6, pi/4), ncol = 2, byrow = TRUE) spherical_to_cartesian(theta_phi)
Run the code above in your browser using DataLab