convert_cartesian_to_spherical {nprotreg} | R Documentation |
Converts Cartesian to Spherical Coordinates.
Description
The Cartesian coordinates of points on a 3-dimensional sphere with unit radius and center at the origin are converted to the equivalent longitude and latitude coordinates, measured in radians.
Usage
convert_cartesian_to_spherical(cartesian_coords)
Arguments
cartesian_coords |
A matrix whose rows contain the Cartesian coordinates of the specified points. |
Value
A matrix of rows containing the longitude and latitude of specific points on a 3-dimensional sphere.
See Also
http://mathworld.wolfram.com/SphericalCoordinates.html.
Other Conversion functions:
convert_spherical_to_cartesian()
Examples
library(nprotreg)
# Define the Cartesian coordinates of the North and South Poles.
north_pole <- cbind(0, 0, 1)
south_pole <- cbind(0, 0, -1)
cartesian_coords <- rbind(north_pole, south_pole)
# Get the corresponding Spherical coordinates.
spherical_coords <- convert_cartesian_to_spherical(cartesian_coords)
[Package nprotreg version 1.1.1 Index]