math_cart2sph: Cartesian to spherical coordinates

math_cart2sphR Documentation

Cartesian to spherical coordinates

Description

Transform Cartesian to spherical coordinates according to international physics convention: \theta in range 0...\pi (0...180 Deg) and \varphi in range 0...2\pi (0...360Deg)

Usage

math_cart2sph(xyz, DEG = FALSE)

Arguments

xyz

c(x, y, z) cartesian coordinates as vector or matrix

DEG

return angles \theta and \varphi in degree instead of radians

Details

https://de.wikipedia.org/wiki/Kugelkoordinaten#Umrechnungen

Value

named vector or matrix

Author(s)

Florian Wagner florian.wagner@wagnius.ch

Examples

math_cart2sph(c(1,1,1), DEG = TRUE)
rbind(c(1,0.5,0.1),
      c(1,0.2,0.6))|>
   math_cart2sph()

wagnius-GmbH/slvwagner documentation built on Jan. 19, 2025, 7:10 a.m.