comparison OrthancStone/Resources/Computations/ComputeShearParameters.py @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Resources/Computations/ComputeShearParameters.py@46cb2eedc2e0
children 8c5f9864545f
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
1 #!/usr/bin/python
2
3 from sympy import *
4 import pprint
5
6 init_printing(use_unicode=True)
7
8 s13, s23, s43 = symbols('s13 s23 s43')
9 x, y, z, w = symbols('x y z w')
10
11 A = Matrix([[ 1, 0, s13, 0 ],
12 [ 0, 1, s23, 0 ],
13 [ 0, 0, 1, 0 ],
14 [ 0, 0, s43, 1 ]])
15
16 print('\nLacroute\'s shear matrix (A.14) is:')
17 pprint.pprint(A)
18
19 # At this point, we can write "print(A*p)". However, we don't care
20 # about the output "z" axis, as it is fixed. So we delete the 3rd row
21 # of A.
22
23 A.row_del(2)
24
25 p = Matrix([ x, y, z, 1 ])
26
27 v = A*p
28 print('\nAction of Lacroute\'s shear matrix on plane z (taking w=1):\n%s\n' % v)
29
30 print('Scaling = %s' % (1/v[2]))
31 print('Offset X = %s' % (v[0]/v[2]).subs(x, 0))
32 print('Offset Y = %s' % (v[1]/v[2]).subs(y, 0))