comparison Resources/Computations/ComputeShearParameters.py @ 191:46cb2eedc2e0 wasm

ShearWarpProjectiveTransform
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Mar 2018 15:01:52 +0100
parents
children
comparison
equal deleted inserted replaced
190:465b294a55f0 191:46cb2eedc2e0
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))