Note to self: matrices

2-D Translation (moving in the x and y direction)

|      1 ;      0  ;     0 |
|      0 ;      1  ;     0 |
| xTrans ; yTrans  ;     1 |

2-D Scaling

| xScale ;      0 ;      0 |
|      0 ; yScale ;      0 |
|      0 ;      0 ;      1 |

2-D Rotation (around the z-axis)

|  cos( angle) ; -sin( angle) ;            0 |
|  sin( angle) ;  cos( angle) ;            0 |
|            0 ;            0 ;            1 |

All of the above 2-D operations combined into one 3×3 matrix

| xScale * cos( angle); xScale * -sin( angle); xscale * -sin(angle) |
| yScale * sin( angle);  yScale * cos( angle);                    0 |
|               xTrans;                yTrans;                    1 |

…according to a game dev book, anyway. Not that these would be important to the project. This last one, call it Q, however might very well be:

2*q[0]^2-1+2*q[1]^2; 2*q[1]*q[2]-2*q[0]*q[3]; 2*q[1]*q[3]+2*q[0]*q[2]
2*q[1]*q[2]+2*q[0]*q[3]; 2*q[0]^2-1+2*q[2]^2; 2*q[2]*q[3]-2*q[0}*q[1]
2*q[1]*q[3]-2*q[9]*q[2]; 2*q[2]*q[3]+2*q[0]*q[2]; 2*q[0]^2-1+2*q[3]^2

w = Q*v, where w and v are 3×1 matrices (vectors). So far, it’s just a “note to self”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s