diff --git a/eulers_from_rot.py b/eulers_from_rot.py index 3d5280f96d7836aa1419a0f8717271d1ca53a26b..eca48817bc65ac572c6c8423301a56c59617ddaf 100644 --- a/eulers_from_rot.py +++ b/eulers_from_rot.py @@ -2,23 +2,10 @@ import sympy from sympy import * phi, theta, psi = symbols("phi theta psi") -Matrix([phi,theta,psi],[psi,phi,theta]) import numpy as np -theta -np.array([theta]) -a=np.array([theta]) -a@a -a*a -e = cos(theta) -e.subs(theta,phi) -Rm = np.array(shape=(3,3)) -Rm = np.array(shape=(3,3),dtype=object) Rm = np.ndarray(shape=(3,3),dtype=object) -Rm x, y, z = symbols("x y z") -alpha = symbol("alpha") alpha = symbols("alpha") -alpha C = 1-cos(alpha) c = cos(alpha) s = sin(alpha) @@ -33,64 +20,19 @@ Rm[2,0] = z*y*C + x*s Rm[2,0] = z*x*C - y*s Rm[2,1] = z*y*C + x*s Rm[2,2] = z*z*C + c -Rm -one = copy(Rm) one = np.copy(Rm) -one -for e in one: - e.subs({x:0,y:0,z:1,alpha:theta}) - -for e in np.nditer(one): - e.subs({x:0,y:0,z:1,alpha:theta}) - -for i in range(3)Ö -for i in range(3): - for j in range(3); -for i in range(3): - for j in range(3): - one[i,j].subs({x:0,y:0,z:1,alpha:theta}) - -one for i in range(3): for j in range(3): - one[i,j] = one[i,j].subs({x:0,y:0,z:1,alpha:theta}) - -one + one[i,j] = one[i,j].subs({x:0,y:0,z:1,alpha:phi}) two = np.copy(Rm) for i in range(3): for j in range(3): two[i,j] = two[i,j].subs({x:-sin(phi),y:cos(phi),z:0,alpha:theta}) - - -one = np.copy(Rm) -for i in range(3): - for j in range(3): - one[i,j] = one[i,j].subs({x:0,y:0,z:1,alpha:phi}) - - -one -two three = np.copy(Rm) for i in range(3): for j in range(3): three[i,j] = three[i,j].subs({x:cos(phi)*sin(theta),y:sin(phi)*sin(theta),z:cos(theta),alpha:psi}) - - - -three@two@one R=three@two@one -R -x0 = np.ndarray(shape=(1,3)) -x0 -x0[0] = 1 -x0[1] = 0 -x0[0,0] = 1 -x0[0,1] = 1 -x0[0,2] = 1 -x0[0,1] = 0 -x0[0,2] = 0 -x0 -R@x0 x0 = np.ndarray(shape=(3,1)) x0[0,0] = 1 x0[1,0] = 0 @@ -98,20 +40,12 @@ x0[2,0] = 0 R@x0 x0[0,0] x1 = R@x0 -x1[0,0] -x1[0,0].simplify() -x1 -x1[1,0] -x1[1,0].simplify() x2 = np.ndarray(shape=(3,1)) for i in range(3): x2[i,0] = x1[i,0].simplify() - x2 = np.ndarray(shape=(3,1),dtype=object) for i in range(3): x2[i,0] = x1[i,0].simplify() - -x2 y0 = np.ndarray(shape=(3,1)) y0[0,0] = 0 y0[1,0] = 1 @@ -120,8 +54,6 @@ y1 = R@y0 y2 = np.ndarray(shape=(3,1),dtype=object) for i in range(3): y2[i,0] = y1[i,0].simplify() - -y2 z0 = np.ndarray(shape=(3,1)) z0[0,1] z0[0,0] = 0 @@ -130,15 +62,10 @@ z0[1,0] = 0 z0[2,0] = 0 z1 = R@z0 z2 = np.ndarray(shape=(3,1),dtype=object) -for i in range(3): - z2[i,0] = z1[i,0].simplify() - -z2 z0[2,0] = 1 z1 = R@z0 for i in range(3): z2[i,0] = z1[i,0].simplify() - -z2 -get_ipython().run_line_magic('save', 'eulers_from_rot.py') -get_ipython().run_line_magic('save', 'eulers_from_rot.py ~0/') +print(x2) +print(y2) +print(z2) diff --git a/so3_sampling.blend b/so3_sampling.blend index fd7e0629195aa1f1a5320c8ffc2f152fe8f7db85..2b88e445be526e145ca75f7b9fb1bfe9e068a740 100644 Binary files a/so3_sampling.blend and b/so3_sampling.blend differ diff --git a/so3_sampling.blend1 b/so3_sampling.blend1 index da6cf28090dcf5eb8361ca74f8fb30f74a862d98..fd7e0629195aa1f1a5320c8ffc2f152fe8f7db85 100644 Binary files a/so3_sampling.blend1 and b/so3_sampling.blend1 differ