pastebin

Paste #O9x -- näytä pelkkänä tekstinä -- uusi tämän pohjalta

Värjäys: Tyyli: ensimmäinen rivinumero: Tabin korvaus:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
wsrc = img_src:width()-1
hsrc = img_src:height()-1

q01 = p01 - p00
q10 = p10 - p00

(p00.x, p00.y, 0, 1)*T = (   0,    0, p00.z, 1)
(p10.x, p10.y, 0, 1)*T = (wsrc,    0, p10.z, 1)
(p01.x, p01.y, 0, 1)*T = (   0, hsrc, p01.z, 1)

(p00.x, p00.y, 0, 1)*T1 = (    0,     0, 0, 1)
(p10.x, p10.y, 0, 1)*T1 = (q10.x, q10.y, 0, 1)
(p01.x, p01.y, 0, 1)*T1 = (q01.x, q01.y, 0, 1)

        (0, 0, 0, 1)*T2 = (   0,    0, 0, 1)
(q10.x, q10.y, 0, 1)*T2 = (wsrc,    0, 0, 1)
(q01.x, q01.y, 0, 1)*T2 = (   0, hsrc, 0, 1)

  (   0,    0, 0, 1)*T3 = (   0,    0, p00.z, 1)
  (wsrc,    0, 0, 1)*T3 = (wsrc,    0, p10.z, 1)
  (   0, hsrc, 0, 1)*T3 = (   0, hsrc, p01.z, 1)

T = T1*T2*T3

     [      1       0  0  0 ]
T1 = [      0       1  0  0 ]
     [      0       0  1  0 ]
     [ -p00.x  -p00.y  0  1 ]

          [ q10.x/wsrc  q10.y/wsrc  0  0 ]
inv(T2) = [ q01.x/hsrc  q01.y/hsrc  0  0 ]
          [          0           0  1  0 ]
          [          0           0  0  1 ]

     [  q01.y/hsrc -q10.y/wsrc  0  0 ]
T2 = [ -q01.x/hsrc  q10.x/wsrc  0  0 ] * wsrc * hsrc / (q10.x * q01.y - q10.y * q01.x)
     [           0           0  1  0 ]
     [           0           0  0  1 ]

     [ 1  0  (p10.z - p00.z)/wsrc  0 ]
T3 = [ 0  1  (p01.z - p01.z)/hsrc  0 ]
     [ 0  0                     1  0 ]
     [ 0  0                 p00.z  1 ]