Você está na página 1de 3

Rotation

For rotation by an angle anticlockwise about the origin, the functional form is x' = xcos ysin and y' = xsin + ycos. Written in matrix form, this becomes

!imilarly, for a rotation clockwise about the origin, the functional form is x' ysin and y' = xsin + ycos and the matrix form is

= xcos +

[edit] Scaling
For scaling "that is, enlarging or shrinking#, we ha$e %he matrix form is and .

When

, then the matrix is a s&uee'e ma((ing and (reser$es areas in the (lane

Translation
)ssentially, translation refers to adding a $ector to each (oint in a sha(e. *magine a (oint at "+, +, +#. *f you wanted to translate that (oint u( one unit, you could con$ert the (oint to a $ector and add it to another $ector, like this
_ _ | | | 0 | | | | 0 | + | | | 0 | |_ _| _ _ | | | 0 | | | | 1 | = | | | 0 | |_ _| _ | | | | 1 | | |_ _ 0 | | _| 0 | | | |

*n essence, translating an ob,ect amounts to adding a $ector to each (oint in the ob,ect.

Scaling
*f translating an ob,ect means adding each (oint to a $ector, scaling could be seen as a multi(lying function. For exam(le, if you ha$e a circle with a (oint at "+, -, +# and

another (oint at "-, +, +#, you could make the circle twice as large by multi(lying each x, y, and ' $alue by .. %he resulting calculation would look something like this
_ _ | | | 0 | | | | 1 | | | | 0 | |_ _| _ _ | | | 0 | | | | 2 | | | | 0 | |_ _| _ _ | | | 1 | | | | 0 | | | | 0 | |_ _| _ _ | | | 2 | | | | 0 | | | | 0 | |_ _|

* 2

* 2

*n fact, you can actually scale in /, 0, and 1 axes inde(endantly. 2ost 34 (ackages allow you to s(ecify a $ector for scaling which se(arately indicates how much you scale in each axis. 5lthough it's not exactly done this way mathematically, you can think of multi(lying two $ectors together for a scale, so if you ha$e a (oint "., ., .# and you want to scale it by "3, 6, 7#, you could "somewhat inaccurately# think of it like this...
_ _ | | | 2 | | | | 2 | * | | | 2 | |_ _| _ _ | | | 3 | | | | 4 | | | | 5 | |_ _| _ | | 6 | = | 8 | | 10 |_ _ | | | | | | _|

8lease note that this is NOT exactly how it's done. 9owe$er, * ha$e sim(lified the math to make the conce(t a little easier to understand. *n reality, the scale is usually done with either a single $alue, one direction at a time, or in a 3 x 3 matrix. !ince * ha$en't shown you matrices yet, *'m sim(lifying the math. !ee any linear algebra book for the com(lete truth.

Two - Dimension Rotation


%o (erform a rotation around the origin in two dimensions, mathematicians ha$e come u( with a series of trig formulas. :et's say we ha$e a (oint at "x, y# and we want to rotate the (oint by a radians. %he new x and y $alues can be determined by the following formulas
x' = (x * cos(a)) + (y * -sin(a)) y' = (x * sin(a)) + (y * cos(a))

;i$en any x, y, and a $alues, you can use these formulas to generate a new (oint x'y' that is rotated a radians around the origin. For exam(le, consider the following situation 0ou ha$e a (oint at "-, -# and you want to rotate it <+ degrees "(i=. radians#.

>y obser$ation, you can (robably tell that the result should be "?-, -#. cos"(i=.# is +, and sin"(i=.# is -. @se a calculator to confirm these results if necessary. Aow, you can re(lace the $ariables with the a((ro(riate $alues
x' = = = = y' = = = = (x * cos(a)) + (y * -sin(a)) (1 * 0) + (1 * -1) 0 - 1 -1 (x * sin(a)) + (y * cos(a)) (1 * 1) + (1 * 0) 1 + 0 1

(x', y') = (-1,1)

Você também pode gostar