Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

A simple function that implements rotation by Euler angles.

View euler_rot.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import numpy as np
def euler_rot(XYZ,phi,theta,psi):
'''Returns the points XYZ rotated by the given euler angles'''
 
 
ERot = np.array([[np.cos(theta)*np.cos(psi),
-np.cos(phi)*np.sin(psi) + np.sin(phi)*np.sin(theta)*np.cos(psi),
np.sin(phi)*np.sin(psi) + np.cos(phi)*np.sin(theta)*np.cos(psi)],
[np.cos(theta)*np.sin(psi),
np.cos(phi)*np.cos(psi) + np.sin(phi)*np.sin(theta)*np.sin(psi),
-np.sin(phi)*np.cos(psi) + np.cos(phi)*np.sin(theta)*np.sin(psi)],
[-np.sin(theta),
np.sin(phi)*np.cos(theta),
np.cos(phi)*np.cos(theta)]])
 
return ERot.dot(XYZ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.