astrodynx.utils.rotmat3dy#
- astrodynx.utils.rotmat3dy(angle)[source]#
Returns a 3x3 rotation matrix for a given angle around the y-axis.
- Parameters:
angle (
ArrayLike) – The angle in radians to rotate around the y-axis.- Return type:
- Returns:
A 3x3 rotation matrix that rotates vectors around the y-axis by the specified angle.
Notes
The rotation matrix is defined as:
\[\begin{split} R_y(\theta) = \begin{bmatrix} \cos(\theta) & 0 & \sin(\theta) \\ 0 & 1 & 0 \\ -\sin(\theta) & 0 & \cos(\theta) \end{bmatrix} \end{split}\]where \(\theta\) is the angle of rotation.References
Battin, 1999, pp.85.
Examples
Creating a rotation matrix for a 90-degree rotation (π/2 radians):
>>> import jax.numpy as jnp >>> import astrodynx as adx >>> angle = jnp.pi / 2 >>> jnp.allclose(adx.utils.rotmat3dy(angle), jnp.array([[0., 0., 1.], [0., 1., 0.], [-1., 0., 0.]]), atol=1e-7) Array(True, dtype=bool)
Broadcasting with an array of angles:
>>> angles = jnp.array([0.0, jnp.pi / 2]) >>> results = jnp.stack([adx.utils.rotmat3dy(a) for a in angles]) >>> expected0 = jnp.eye(3) >>> expected1 = jnp.array([[0., 0., 1.], [0., 1., 0.], [-1., 0., 0.]]) >>> jnp.allclose(results[0], expected0, atol=1e-7) Array(True, dtype=bool) >>> jnp.allclose(results[1], expected1, atol=1e-7) Array(True, dtype=bool)