- Timestamp:
- Sep 19, 2017 4:04:26 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 62d7601
- Parents:
- 8db25bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/angles.py
re755d8a rbf09f55 1 from __future__ import print_function 2 1 3 import sympy as sp 2 dphi, dpsi, dtheta = sp.var("dphi dpsi dtheta") 4 sp.init_printing() 5 dphi, dpsi, dtheta = sp.var("phi_d psi_d theta_d") 3 6 phi, psi, theta = sp.var("phi psi theta") 4 7 x, y, z = sp.var("x y z") 5 8 qx, qy, qz = sp.var("qx qy qz") 9 qa, qb, qc = sp.var("qa qb qc") 6 10 7 11 def Rx(a): … … 13 17 14 18 print("==== asymmetric ====") 15 q = sp.Matrix([[qx],[qy],[0]]) 16 p = sp.Matrix([[x],[y],[z]]) 19 q_xy = sp.Matrix([[qx], [qy], [0]]) 20 q_abc = sp.Matrix([[qa], [qb], [qc]]) 21 p_xyz = sp.Matrix([[x], [y], [z]]) 17 22 jitter = Rx(dphi)*Ry(dtheta)*Rz(dpsi) 18 23 view = Rz(phi)*Ry(theta)*Rz(psi) 19 jitter_inv = Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi)20 24 view_inv = Rz(-psi)*Ry(-theta)*Rz(-phi) 21 25 print(">> jitter rotation") 22 for row in jitter*p :print(row)23 print("\n>> jitter plus view")24 for row in view*jitter*p:print(row)26 for row in jitter*p_xyz: sp.pprint(row) 27 #print("\n>> jitter plus view") 28 #for row in view*jitter*p_xyz: sp.pprint(row) 25 29 print("\n>> view reverse") 26 for row in view_inv*q :print(row)30 for row in view_inv*q_xy: sp.pprint(row) 27 31 print("\n>> jitter reverse") 28 for row in jitter_inv*view_inv*q: print(row) 32 jitter_inv = Rz(-psi)*Ry(-theta)*Rx(-phi) 33 for row in jitter_inv*q_abc: sp.pprint(row) 34 print("\n>> jitter view reverse") 35 jitter_inv = Rz(-dpsi)*Ry(-dtheta)*Rx(-dphi) 36 for row in jitter_inv*view_inv*q_xy: sp.pprint(row) 29 37 30 38 print("\n\n==== symmetric ====") 31 q = sp.Matrix([[qx],[0],[0]]) 32 p = sp.Matrix([[x],[y],[z]]) 39 q_x = sp.Matrix([[qx], [0], [0]]) 40 q_ac = sp.Matrix([[qa], [0], [qc]]) 41 p_xyz = sp.Matrix([[x], [y], [z]]) 33 42 jitter = Rx(dphi)*Ry(dtheta) 34 43 view = Rz(phi)*Ry(theta) … … 36 45 view_inv = Ry(-theta)*Rz(-phi) 37 46 print(">> jitter rotation") 38 for row in jitter*p :print(row)39 print("\n>> jitter plus view")40 for row in view*jitter*p:print(row)47 for row in jitter*p_xyz: sp.pprint(row) 48 #print("\n>> jitter plus view") 49 #for row in view*jitter*p_xyz: sp.pprint(row) 41 50 print("\n>> view reverse") 42 for row in view_inv*q :print(row)51 for row in view_inv*q_x: sp.pprint(row) 43 52 print("\n>> jitter reverse") 44 for row in jitter_inv* view_inv*q:print(row)53 for row in jitter_inv*q_ac: sp.pprint(row)
Note: See TracChangeset
for help on using the changeset viewer.