v3d.math.spherical_to_carthesian#

visu3d.math.spherical_to_carthesian(r: etils.enp.array_types.typing.FloatArray | None = None, theta: etils.enp.array_types.typing.FloatArray | None = None, phi: etils.enp.array_types.typing.FloatArray | None = None, *, xnp: Any = Ellipsis) etils.enp.array_types.typing.FloatArray[source]#

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

Follow https://mathworld.wolfram.com/SphericalCoordinates.html conventions.

Usage:

v3d.math.spherical_to_carthesian(r, theta, phi)
v3d.math.spherical_to_carthesian(theta=theta, phi=phi)
Parameters:
  • r – If None, assume 1.

  • theta – azimuth / longitude

  • phi – polar / elevation / colatitude

  • xnp – Numpy module

Returns:

3d coordinates

Return type:

points