Geometry Utilities¶
Coordinate Conversion¶
- ear.core.geom.cart(az, el, dist, axis=- 1)¶
Convert ADM-format polar positions to ADM-format Cartesian.
- Parameters
az – Azimuths in degrees, angle measured anticlockwise from front.
el – Elevations in degrees, angle measured up from equator.
r – Radii.
axis – Index of the new axis in the result; see
numpy.stack(). -1 (default) adds a new axis at the end.
- Returns
Same shape as broadcasting az, el and r together, with a new axis at axis containing the X, Y and Z coordinates.
- Return type
ndarray
Examples
>>> cart(0, 0, 1) array([0., 1., 0.]) >>> cart(90, 0, 1).round(6) array([-1., 0., 0.]) >>> cart(0, 90, 1).round(6) array([0., 0., 1.]) >>> # inputs are broadcast together... >>> cart([0, 90], 0, 1).round(6) array([[ 0., 1., 0.], [-1., 0., 0.]]) >>> # ... along the given axis >>> cart([0, 90], 0, 1, axis=0).round(6) array([[ 0., -1.], [ 1., 0.], [ 0., 0.]])
- ear.core.geom.azimuth(positions, axis=- 1)¶
Get the azimuth in degrees from ADM-format Cartesian positions.
- Parameters
positions (array of float) – Cartesian positions, with X, Y and Z positions along axis axis.
axis (int) – Axis to find coordinates along. -1 (default) indicates the last axis.
- Returns
- Azimuths of the positions in degrees; has the same shape as
positions, with axis removed.
- Return type
array
- Raises
ValueError – If positions does not have the right length along axis.
Examples
>>> azimuth([0, 1, 0]).round(0).astype(int) 0 >>> azimuth([[1, 0, 0], [0, 1, 0]]).round(0).astype(int) array([-90, 0]) >>> azimuth([[1, 0], [0, 1], [0, 0]], axis=0).round(0).astype(int) array([-90, 0])