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.


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

asstringoptional[a]_spherical2cartesian Output prefix of fields to set with suffixes .x, .y and .z (e.g., as.x, as.y, as.z).
azimuthstringrequired  Azimuthal angle measured from the x-axis.
polarnumberrequired  Polar angle measured from the xy-plane.
radiusstringrequired1.0 Radius of the sphere.

[a] Optional parameters use their default value unless explicitly set

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).

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 LogScale like the one below:

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.