How do I translate this 3x3 affine transformation matrix int a 4x4 transformation matrix?

940 Views Asked by At

I am wondering how to change the 3x3 affine transformation matrix here:

enter image description here

...into a 4x4 transformation matrix:

    ┌             ┐
T = | 1  0  0  tx |
    | 0  1  0  ty |
    | 0  0  1  tz |
    | 0  0  0   1 |
    └             ┘

I understand how the upper-left 3x3 of the 4x4 is for rotation and scale, how do the a/b/c/d/e/f/g/h/i of the 3x3 correspond to the positions of the 4x4. It seems like you could just copy in a, b, d, e in the same spots in the 4x4...but that leaves a bunch of spots unaccounted for...mainly - I know that my application scales and I would be missing an sz variable (see below) if I did it like that...I think.

    ┌               ┐
S = | sx   0   0  tx|
    |  0  sy   0  ty|
    |  0   0  sz  tz|
    |  0   0   0  1 |
    └               ┘

    ┌              ┐
S = |  a   b   tx  |
    |  d   e   ty  | ... with any values for a, b, d, e, s, w, tx, ty
    |  s   w   1   |
    |              |
    └              ┘

to .......

    ┌             ┐
T = | f  g  h  tx |
    | i  j  k  ty |
    | l  m  n  tz |
    | r  p  q   j |
    └             ┘

Connect the letters, which letters in the 3x3 goes to which letters in the 4x4 for an affine transformation (obviously tx, ty, tz are the same for both, and I know where those go)

UPDATE

For the comment about how the 3x3 is an affine transformation. Below is the matrix...here is a link Link See "2D Affine Transformations"...I am essentially trying to take the 2D Affine Transformation and turn it into a 3D (4x4 matrix)...the 2D should correspond to the 3D somehow...

enter image description here