spheresmooth.coords#

coords.py — Public coordinate transformation utilities for spheresmooth

This module provides the same functionality as the exported coordinate transformation functions in the R package spheresmooth. The functions here define the public-facing API for converting between Cartesian and spherical coordinates and performing equal-distance projection (EDP). All lower-level geometric or optimization-related computations are encapsulated inside internal modules such as _internal.py and geometry.py.

Features provided:

  • Conversion between Cartesian and spherical coordinates (cartesian_to_spherical, spherical_to_cartesian)

  • Equal-distance projection onto the plane (edp), matching the R implementation

  • Input handling supporting both row-wise and column-wise formats

  • Numerically stable trigonometric computations and normalization

This module works closely with geometry.py and smoothing.py and follows the coordinate-handling conventions of the original R implementation in spheresmooth.

Functions

cartesian_to_spherical(x[, byrow])

Convert Cartesian coordinates to spherical coordinates (theta, phi).

edp(p)

Equal-distance projection (EDP) of a point on the unit sphere onto the tangent plane at the north pole.

spherical_to_cartesian(theta_phi[, byrow])

Convert spherical coordinates (theta, phi) to Cartesian coordinates (x, y, z).