cedalion.geometry.utils
Utility functions for geometric calculations.
Functions
|
Convert 3D cartesian into spherical coordinates. |
|
Return a 4×4 homogeneous rotation matrix R = Rz(α)·Ry(β)·Rx(γ). |
|
Return a 4×4 homogeneous isotropic scaling matrix. |
|
Return a 4×4 homogeneous anisotropic scaling matrix. |
|
Return a 4×4 homogeneous translation matrix. |
|
Convert 2D polar into 2D cartesian coordinates. |
- cedalion.geometry.utils.m_trans(t: ndarray) ndarray[source]
Return a 4×4 homogeneous translation matrix.
- Parameters:
t – Translation vector
[tx, ty, tz].- Returns:
4×4 NumPy array encoding the translation as a homogeneous transform.
- cedalion.geometry.utils.m_scale3(s: ndarray) ndarray[source]
Return a 4×4 homogeneous anisotropic scaling matrix.
- Parameters:
s – Scale factors
[sx, sy, sz]for each axis independently.- Returns:
4×4 NumPy array encoding the anisotropic scaling as a homogeneous transform.
- cedalion.geometry.utils.m_scale1(s: ndarray) ndarray[source]
Return a 4×4 homogeneous isotropic scaling matrix.
- Parameters:
s – Array whose first element is the uniform scale factor applied to all axes.
- Returns:
4×4 NumPy array encoding the isotropic scaling as a homogeneous transform.
- cedalion.geometry.utils.m_rot(angles: ndarray) ndarray[source]
Return a 4×4 homogeneous rotation matrix R = Rz(α)·Ry(β)·Rx(γ).
See https://en.wikipedia.org/wiki/Rotation_matrix#General_rotations.
- Parameters:
angles – Euler angles
[alpha, beta, gamma]in radians, corresponding to rotations about Z, Y, and X axes respectively.- Returns:
4×4 NumPy array encoding the combined rotation as a homogeneous transform.
- cedalion.geometry.utils.cart2sph(
- x: ndarray,
- y: ndarray,
- z: ndarray,
Convert 3D cartesian into spherical coordinates.
- Parameters:
x – cartesian x coordinates
y – cartesian y coordinates
z – cartesian z coordinates
- Returns:
The spherical coordinates azimuth, elevation and radius as np.ndarrays.