Cartesian_to_Spherical {spheresmooth} | R Documentation |
Convert Cartesian coordinates to cpherical coordinates
Description
This function converts Cartesian coordinates to spherical coordinates.
Usage
Cartesian_to_Spherical(x)
Arguments
x |
A matrix where each row represents a point in Cartesian coordinates. |
Details
The Cartesian coordinates (x, y, z) are converted to spherical coordinates (theta, phi). Theta represents the inclination angle (0 to pi), and phi represents the azimuth angle (0 to 2*pi).
Value
A matrix where each row represents a point in spherical coordinates.
Examples
#example1
cartesian_points1 <- matrix(c(1/sqrt(3), 1/sqrt(3), 1/sqrt(3),-1/sqrt(3), 1/sqrt(3), -1/sqrt(3)),
ncol = 3, byrow = TRUE)
Cartesian_to_Spherical(cartesian_points1)
#example2
cartesian_points2 <- matrix(c(1, 0, 0, 0, 1, 0, 0, 0, 1),ncol = 3, byrow = TRUE)
Cartesian_to_Spherical(cartesian_points2)
[Package spheresmooth version 0.1.0 Index]