### `math:spherical2cartesian()`

This query function converts given spherical coordinates to cartesian coordinates. The coordinate system uses z as the up-axis and measures the azimuthal angle from the x-axis.

### Note

This query function is not yet available, but expected to be released in a future version of Humio.

ParameterTypeRequiredDefaultDescription
`as`stringfalse_spherical2cartesianOutput prefix of fields to set with suffixes `.x`, `.y` and `.z` (e.g., `as.x`, `as.y`, `as.z`).
`azimuth`stringtrue Azimuthal angle measured from the x-axis.
`polar`numbertrue Polar angle measured from the xy-plane.
`radius`stringtrue1.0Radius of the sphere.

The `math:spherical2cartesian()` query function requires three parameters: the azimuth, the polar, and the radius. If no radius is specified, a radius of 1.0 is used.

If the polar angle is set to 90 degrees, the returned coordinates will be (0.0, 0.0, 1.0). If both polar and azimuthal angles are set to 0, the returned coordinates will be (1.0, 0.0, 0.0).

#### Examples

For geographical coordinates, the azimuth corresponds to longitude and the polar angle to latitude. To convert from geographical coordinates to the cartesian coordinates of the point on the unit-sphere, you would enter a query into Humio like the one below:

humio
```lat := 90.0 | lon := 0.0 |
math:spherical2cartesian(azimuth=lon, polar=lat, radius = 1.0, as=p)```

The results will be in the fields `p.x`, `p.y` and `p.z`.