JavaScript EditorFree JavaScript Editor     Ajax Editor 



Main Page
  Previous Section Next Section

Scaling

To scale a point relative to the origin, you want to multiply the x,y components by scaling factors sx and sy, respectively. In addition, you want no translation during the scaling operation. Here's the matrix you want:

    |sx  0   0|
Ms =|0   sy  0|
    |0   0   1|

Eg. p = [x y 1]


                      |sx  0   0|
p' = p*Ms = [x y 1] * |0   sy  0| = [(x*sx) (y*sy) 1]
                      |0   0   1|

Again, this is the desired result for scaling; that is

x' = sx*x
y' = sy*y

MATH

Note the 1 in the lower-right corner of the transformation matrix. Technically, it's not necessary because you're never going to use the result from the third column. Hence, you're wasting math cycles. The question is, can you remove the last column of all the transformation matrices and use a 3x2 instead? Let's see the rotation matrix before you answer that…


      Previous Section Next Section
    



    JavaScript EditorAjax Editor     JavaScript Editor