71 | 71 | The above matrix equation is shorthand for four equations: one equation each for o,,11,,, o,,12,,, o,,21,, and o,,22,,. We will perform the multiplications on the right hand side one at a time. |
72 | 72 | |
| 73 | [[Image(aggregate_step2.png)]] |
| 74 | |
| 75 | [[Image(aggregate_step3.png)]] |
| 76 | |
| 77 | [[Image(aggregate_step4.png)]] |
| 78 | |
| 79 | * o,,11,, = s,,x,, ( (1 + k,,x,, k,,y,,) cosθ + k,,y,, sinθ ) |
| 80 | * o,,12,, = s,,x,, ( k,,x,, cosθ + sinθ ) |
| 81 | * o,,21,, = s,,y,, ( -(1 + k,,x,, k,,y,,) sinθ + k,,y,, cosθ ) |
| 82 | * o,,22,, = s,,y,, ( - k,,x,, sinθ + cosθ ) |
| 83 | |
| 84 | Notice that none of the coefficients in the '''O''' matrix may be said to represent pure scaling, rotation or shearing. Rather, they all have components of each of these operations factored in. If a particular transformation is not needed (say there is no shearing in either the x or y directions), then the relevant parameters may be set to zero (k,,x,, = k,,y,, = 0). |
| 85 | |
| 86 | Also notice that it is not necessary to compute this matrix every time one wants to convert between pixel indices and geographic location. The coefficients are computed once for the entire raster, and may be reused for every pixel calculation. You would use this aggregate matrix '''O''' exactly as you would use any of the individual matrices: |
| 87 | |
| 88 | [[Image(aggregate_usage.png)]] |
75 | | Starting from the beginning: We want to be able to calculate the |
76 | | parameters for an affine transform which includes the operations: |
77 | | scaling, translation, rotation, and skew (shearing). Matrices for |
78 | | these individual operations are found on |
79 | | http://en.wikipedia.org/wiki/Transformation_matrix#Examples_in_2D_graphics |
80 | | . What ho! We can combine these individual operations willy nilly by |
81 | | matrix multiplication. But note that these individual matrices are the |
82 | | only places where individual coefficients represent meaningful |
83 | | parameters. Once you start the multiplication, the coefficients become |
84 | | all jumbled up with terms combined in various ways. |
85 | | |
86 | | So, using wikipedia plus a little customization, I've labeled the PURE |
87 | | coefficients (as opposed to our jumbled coefficients) as follows: |