convert_spherical_to_cartesian: Converts Spherical to Cartesian Coordinates.

View source: R/convert_spherical_to_cartesian.R

convert_spherical_to_cartesianR Documentation

Converts Spherical to Cartesian Coordinates.

Description

The longitude and latitude coordinates of points on a 3-dimensional sphere with unit radius and center at the origin are converted to the equivalent Cartesian coordinates.

Usage

convert_spherical_to_cartesian(spherical_coords)

Arguments

spherical_coords

A matrix of rows containing the longitude and latitude, measured in radians, of specific points on a 3-dimensional sphere.

Value

A matrix whose rows contain the Cartesian coordinates of the specified points.

See Also

http://mathworld.wolfram.com/SphericalCoordinates.html.

Other Conversion functions: convert_cartesian_to_spherical()

Examples

library(nprotreg)

# Define the Spherical coordinates of the North and South Poles.

north_pole <- cbind(0, pi / 2)
south_pole <- cbind(0, - pi / 2)
spherical_coords <- rbind(north_pole, south_pole)

# Get the corresponding Cartesian coordinates.

cartesian_coords <- convert_spherical_to_cartesian(spherical_coords)

nprotreg documentation built on Sept. 28, 2023, 9:06 a.m.