annotate OrthancStone/Resources/Computations/ComputeWarp.py @ 1739:9ac2a65d4172

upgrade to year 2021
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Jan 2021 17:50:00 +0100
parents 8563ea5d8ae4
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/usr/bin/python
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
3 # Stone of Orthanc
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
5 # Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
6 # Copyright (C) 2017-2021 Osimis S.A., Belgium
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
7 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
8 # This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
9 # modify it under the terms of the GNU Lesser General Public License
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
10 # as published by the Free Software Foundation, either version 3 of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
11 # the License, or (at your option) any later version.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
12 #
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
13 # This program is distributed in the hope that it will be useful, but
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
16 # Lesser General Public License for more details.
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
17 #
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
18 # You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
19 # License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
20 # <http://www.gnu.org/licenses/>.
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
21
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
22
193
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 from sympy import *
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 from sympy.solvers import solve
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 import pprint
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 import sys
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 init_printing(use_unicode=True)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 # Create a test 3D vector using homogeneous coordinates
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 x, y, z, w = symbols('x y z w')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 p = Matrix([ x, y, z, w ])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 # Create a shear matrix, and a scale/shift "T * S" transform as in
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 # Lacroute's thesis (Equation A.16, page 209)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 ex, ey, ew = symbols('ex ey ew')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 sx, sy, tx, ty = symbols('sx sy tx ty')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 TS = Matrix([[ sx, 0, 0, tx ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 [ 0, sy, 0, ty ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 [ 0, 0, 1, 0 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 [ 0, 0, 0, 1 ]])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 pureShear = Matrix([[ 1, 0, ex, 0 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 [ 0, 1, ey, 0 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 [ 0, 0, 1, 0 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 [ 0, 0, ew, 1 ]])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 # Create a general warp matrix, that corresponds to "M_warp" in
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 # Equation (A.17) of Lacroute's thesis:
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 ww11, ww12, ww13, ww14, ww21, ww22, ww23, ww24, ww31, ww32, ww33, ww34, ww41, ww42, ww43, ww44 = symbols('ww11 ww12 ww13 ww14 ww21 ww22 ww23 ww24 ww31 ww32 ww33 ww34 ww41 ww42 ww43 ww44')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 WW = Matrix([[ ww11, ww12, ww13, ww14 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 [ ww21, ww22, ww23, ww24 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 [ ww31, ww32, ww33, ww34 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 [ ww41, ww43, ww43, ww44 ]])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 # Create the matrix of intrinsic parameters of the camera
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 k11, k22, k14, k24 = symbols('k11 k22 k14 k24')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 K = Matrix([[ k11, 0, 0, k14 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 [ 0, k22, 0, k24 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 [ 0, 0, 0, 1 ]])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 # The full decomposition is:
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 M_shear = TS * pureShear
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 M_warp = K * WW * TS.inv()
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 AA = M_warp * M_shear
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 # Check that the central component "M_warp == K * WW * TS.inv()" that
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 # is the left part of "A" is another general warp matrix (i.e. no
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 # exception is thrown about incompatible matrix sizes):
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 M_warp * p
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 if (M_warp.cols != 4 or
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 M_warp.rows != 3):
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 raise Exception('Invalid matrix size')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 # We've just shown that "M_warp" is a general 3x4 matrix. Let's call
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 # it W:
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 w11, w12, w13, w14, w21, w22, w23, w24, w41, w42, w43, w44 = symbols('w11 w12 w13 w14 w21 w22 w23 w24 w41 w42 w43 w44')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 W = Matrix([[ w11, w12, w13, w14 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 [ w21, w22, w23, w24 ],
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 [ w41, w43, w43, w44 ]])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 # This shows that it is sufficient to study a decomposition of the
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 # following form:
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 A = W * M_shear
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 print('\nA = W * M_shear =')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 pprint.pprint(A)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 sys.stdout.write('\nW = ')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 pprint.pprint(W)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 sys.stdout.write('\nM_shear = ')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 pprint.pprint(M_shear)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 # Let's consider one fixed 2D point (i,j) in the intermediate
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 # image. The 3D points (x,y,z,1) that are mapped to (i,j) must satisfy
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 # the equation "(i,j) == M_shear * (x,y,z,w)". As "M_shear" is
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 # invertible, we solve "(x,y,z,w) == inv(M_shear) * (i,j,k,1)".
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 i, j, k = symbols('i j k')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 l = M_shear.inv() * Matrix([ i, j, k, 1 ])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 print('\nLocus for points imaged to some fixed (i,j,k,l) point in the intermediate image:')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 print('x = %s' % l[0])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 print('y = %s' % l[1])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 print('z = %s' % l[2])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 print('w = %s' % l[3])
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 # By inspecting the 4 equations above, we see that the locus entirely
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 # depends upon the "k" value that encodes the Z-axis
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 print('\nGlobal effect of the shear-warp transform on this locus:')
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 q = expand(A * l)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 pprint.pprint(q)
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 print("\nWe can arbitrarily fix the value of 'k', so let's choose 'k=0':")
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 pprint.pprint(q.subs(k, 0))
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 print("\nThis gives the warp transform.")
4abddd083374 ShearWarpProjectiveTransform::ApplyAxial()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 print("QED: line after Equation (A.17) on page 209.\n")