Transformation Mathematics

The transformation of a picture can be represented in general terms by two linear equations that define how the (x,y) coordinates of each point in the picture are changed.

 ┌───────────────────────────────────────────┬─────────────────────────────────────────┐
 │  The general form of these equations is:  │  where                                  │
 │                                           │                                         │
 │  x' = Ax + Cy + E                         │    (x,y) defines the original point     │
 │                                           │    (x',y') is the transformed point     │
 │  y' = Bx + Dy + F                         │    A, B, C, D, E, and F are constants.  │
 │                                           │                                         │
 └───────────────────────────────────────────┴─────────────────────────────────────────┘

The transformations that result from these equations depend on the values of the constants, which in turn vary according to the type of transformation being applied.

The operating system handles transformations by using matrix mathematics. In the matrix mathematics,

If all the transformations were multiplication operations, different types of transformation could be applied with a single transformation operation. Therefore, to facilitate the combining of calls, translation in the IBM OS/2 is performed as a multiplication operation, rather than an addition operation.

This requires that the vector representing a point, [ x y ] be extended by a third component, w: [ x y w ]
This enables all the transformations to be handled in a uniform manner.

This is called a homogeneous coordinate system. The value, w, is a multiplier, so that the point represented is: (wx, wy).

Note: The PM does not support a 3-dimensional presentation space. The 3-dimensional matrix is created to effect matrix multiplication.

In this notation, the point (x, y) is represented as [ x y 1 ]. To be able to operate on such three-element vectors, and to combine translation with the multiplication operations, the 2-by-2 matrix has to be extended to a 3-by-3 matrix, with the third column being:

       0
       0
       1

  ┌────────────────────────────────┬─────────────────────────────────────────┐
  │  The linear equations:         │  become the matrix equations:           │
  │                                │                            ┌         ┐  │
  │  x' = Ax + Cy + E              │                            │ A  B  0 │  │
  │                                │  [ x' y' 1 ] = [ x y 1 ] * │ C  D  0 │  │
  │  y' = Bx + Dy + F              │                            │ E  F  1 │  │
  │                                │                            └         ┘  │
  └────────────────────────────────┴─────────────────────────────────────────┘

In standard matrix notation, you have:

                            ┌                      ┐
                            │ Msub11 Msub12 Msub13 │
  [ x' y' 1 ] = [ x y 1 ] * │ Msub21 Msub22 Msub23 │
                            │ Msub31 Msub32 Msub33 │
                            └                      ┘


[Back: Combining Transformations Between a Coordinate Space Pair]
[Next: Model for Building the Transformation Matrix]