Module spherical

Module spherical 

Source
Expand description

Spherical coordinate transformations

This module provides functions for transforming between Cartesian and spherical coordinate systems, as well as utilities for working with spherical coordinates.

Spherical coordinates use the following convention:

  • r (radius): Distance from the origin to the point
  • theta (polar angle): Angle from the positive z-axis (0 to π)
  • phi (azimuthal angle): Angle from the positive x-axis in the xy-plane (0 to 2π)

Note: This convention (r, theta, phi) is used in physics. In mathematics, the convention (r, phi, theta) is sometimes used. We follow the physics convention.

Functions§

cart_to_spherical
Converts Cartesian coordinates (x, y, z) to spherical coordinates (r, theta, phi)
cart_to_spherical_batch
Converts multiple Cartesian coordinates to spherical coordinates
geodesic_distance
Calculates the geodesic distance between two points on a sphere
spherical_to_cart
Converts spherical coordinates (r, theta, phi) to Cartesian coordinates (x, y, z)
spherical_to_cart_batch
Converts multiple spherical coordinates to Cartesian coordinates
spherical_triangle_area
Calculates the area of a spherical triangle given by three points on a unit sphere