Changes between Version 9 and Version 10 of DevWikiAffineParameters


Ignore:
Timestamp:
11/27/11 14:01:42 (13 years ago)
Author:
bnordgren
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevWikiAffineParameters

    v9 v10  
    115115 * x' = o,,11,, i + o,,12,, j
    116116 * y' = o,,21,, i + o,,22,, j
     117
     118== Calculating terms ==
     119
     120The linear transform matrix '''O''', calculated in the previous section, contained some terms which need to be calculated from the provided, physically significant inputs. These terms are s,,i,,, s,,j,,, k,,i,, and f.
     121
     122=== Reflection term ===
     123
     124The coefficient ''f'' essentially represents a decision as to whether the ''j'' axis needs to be flipped. If f=1, the j axis is not flipped. If f=-1, the j axis is flipped. The decision of whether to flip the j axis is controlled by the θ,,ij,, input parameter as follows:
     125
     126 * if θ,,ij,, < 0 then f = -1
     127 * if θ,,ij,, >= 0 then f = 1
     128
     129=== Scaling along i axis ===
     130
     131Scaling along the i axis is represented by the s,,i,, term. We will set it using the magnitude of the '''i,,b,,''' basis vector. This section will go about proving that this is a valid thing to do.
     132
     133To simplify things and remove clutter from the equation, note that the final component of the aggregate transform (rotation) does not affect the magnitude of the basis vector. So, the i unit vector projected thru a non-rotating transform is calculated as follows:
     134
     135[[Image(basisvector_i.png)]]
     136
     137The magnitude of '''i,,b,,''' is given as follows:
     138
     139[[Image(basisvectormag_i.png)]]
     140
     141From the above:
     142
     143 * s,,i,, = magnitude of '''i,,b,,'''
     144
     145=== Shearing parallel to i axis ===
     146
     147Any value of θ,,ij,, which is not plus or minus 90 degrees indicates that shearing parallel to the i axis is required. This produces diamond shaped (non-rectangular) pixels in the output. In this section, we calculate a value for k,,i,, from the specific value of θ,,ij,,. We do this using the configuration in the following diagram:
     148
     149[[Image(shearing_params.png)]]
     150
     151In this diagram, θ,,s,, represents the shearing angle, which is a [http://en.wikipedia.org/wiki/Complementary_angles complementary angle] to θ,,ij,,. The provided equation defines θ,,s,, = 90f - θ,,ij,, in order to have a single equation which is correct whether the j axis is flipped or not.
     152
     153 * k,,i,, = tan(90f - θ,,ij,,)
     154
     155This equation passes the basic sanity check that k,,i,,=0 when θ,,ij,, is plus or minus 90 and f is defined as above. Note that θ,,ij,, = 0 or 180 degrees is an error. This is not just a mathematical artifact. The basis vectors are not allowed to be parallel to each other because then you no longer have a grid.
     156
     157=== Scaling along the j axis ===
     158
     159Scaling along the j axis is represented by the s,,j,, term. We will set it using the magnitude of the '''j,,b,,''' basis vector and the above defined terms. This will be more complex than the corresponding calculation for the i axis, due to the possible presence of shearing.
     160
     161The '''j,,b,,''' basis vector is represented as follows:
     162
     163[[Image(basisvector_j.png)]]
     164
     165The magnitude of '''j,,b,,''' is then calculated as follows:
     166
     167[[Image(basisvectormag_j.png)]]
     168
     169Substituting for k,,i,, and solving for s,,j,,:
     170
     171[[Image(scalefactor_j.png)]]
     172
    117173
    118174== Constructing the affine transformation ==