Rotations in N-Dimensions
See original GitHub issueThe following code creates a rotation matrix in 2D taking the angle as 30 degrees.
import numpy as np
theta = np.radians(30)
r = np.array(( (np.cos(theta), -np.sin(theta)),
(np.sin(theta), np.cos(theta)) ))
print('rotation matrix:')
print(r)
Output:
rotation matrix:
[[ 0.8660254 -0.5 ]
[ 0.5 0.8660254]]
We can add a single function that takes the angle and dimension as the input and returns a rotation matrix. I want to work on this.
Reference: https://github.com/numpy/numpy/issues/17043
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
Maths - Rotations in 'n' Dimensions - EuclideanSpace
Rotation is a transform which preserves distances and angles (for an introduction see this page). Here we explore the issues when we extend...
Read more >Rotations in Higher Dimensions - Analytic Physics
In higher dimensions there are even more axes perpendicular to each plane, so a rotation in n dimensions is best described as being...
Read more >Finding the rotation matrix in n-dimensions
One way to do this is to find two orthonormal vectors in the plane generated by your two vectors, and then extend it...
Read more >How to Represent Multi-Dimensional Rotations, Including ...
In this document, we discuss rotations, including simple rotations in the ... unit basis vector in N dimensions ups unit pseudo-scalar in N...
Read more >Rotation Matrices in two, three and many dimensions
Proper and improper rotation matrices in n dimensions. A matrix is a representation of a linear transformation, which can be viewed as a....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@rgommers As noted in the NumPy issue, the functionality you point to is for rotations in 3D space, not 2D.
I was investigating general rotations in n dimensions this weekend. Based on this I build this script (together with tests): https://github.com/davidblitz/torch-rot/blob/main/torch_rot/rotations.py It is based on formula (15) from this website: https://analyticphysics.com/Higher Dimensions/Rotations in Higher Dimensions.htm
The script is written with torch functions but it can easily be changed to use only numpy. Let me know if you have any questions or comments.