question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rotations in N-Dimensions

See original GitHub issue

The 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:open
  • Created 3 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
rkerncommented, Aug 10, 2020

@rgommers As noted in the NumPy issue, the functionality you point to is for rotations in 3D space, not 2D.

0reactions
davidblitzcommented, Feb 15, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found