Commit a5c7c7a8 authored by karius's avatar karius

cleaned up eulers from rot

parent 2156db54
......@@ -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)
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment