Skip to main content

cartesian_to_spherical

Function cartesian_to_spherical 

Source
pub fn cartesian_to_spherical(v: &Vec3) -> (Real, Real, Real)
Expand description

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

  • r = radial distance ≥ 0
  • theta = polar angle ∈ [0, π] (from +Z axis)
  • phi = azimuthal angle ∈ (-π, π] (in XY plane from +X axis)