JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
  Previous Section Next Section

Translation

To perform translation, you want to leave the x,y components alone while adding the translation factors to x,y. This matrix will do the job:

    |1  0  0 |
Mt =|0  1  0 |
    |dx dy 0 |

Example:

p = [x y 1]

                      |1  0  0 |
p' = p*Mt = [x y 1] * |0  1  0 | = [(x+1*dx) (y+1*dy) 1]
                      |dx dy 1 |

MATH

Notice the necessity of the 1.0 factor in the left-hand matrix representing the point. Without it, there would be no way to perform translation.


And if you pull out the first two elements, you get

x' = x+dx
y' = y+dy

This is exactly what you wanted.

      Previous Section Next Section
    



    JavaScript EditorAjax Editor     JavaScript Editor