Created
October 30, 2021 01:08
-
-
Save jmbr/26522a3c58e677298d2cf56522543db3 to your computer and use it in GitHub Desktop.
Quick and dirty sampling of small rotation matrices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Quick and dirty sampling of small rotation matrices.""" | |
import numpy as np | |
from scipy.linalg import expm | |
from scipy.spatial.transform import Rotation | |
n: int = 3 # Dimensions | |
epsilon: float = 1e-2 # Amplitude of the rotation | |
A = np.random.rand(n, n) | |
A = epsilon * (A - A.T) / 2.0 | |
B = expm(A) | |
print(Rotation.from_matrix(B).as_euler('xyz', degrees=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment