3x3 Matrix Rotation in C++ -


alright, first off, know similar questions on web, have looked @ more i'd care count, i've been trying figure out 3 weeks (not constantly, on , off, hoping spark of insight).

in end, want get, function pass in how want rotate (currently i'm working in radian's, can go degrees or radians) , returns rotation matrix, preserving translations had.

i understand formula rotate on "z" axis in 2d cartesian plane, is:

[cos(radians)    -sin(radians)    0] [sin(radians)     cos(radians)    0] [0                0               1] 

i understand matrix maths (addition, subtraction, multiplication , determinant/inverse) well, i'm not understanding, how to, step-by-step, make matrix can use rotation, preserving translation (and whatever else, scale) has.

from i've gathered other examples, multiply current matrix (whatever may be, let's use identity matrix now), matrix this:

[cos(radians) - sin(radians)] [sin(radians) + cos(radians)] [1] 

but original matrix end 3x1 matrix instead of 3x3, wouldn't it? i'm not sure i'm missing, doesn't seem right me. i'm not looking code write me, understand how , can write myself. (not won't @ other's code :) )

(not sure if matters anybody, in-case, using windows 7 64-bit, visual studio 2010 ultimate, , believe opengl, uni)

while we're @ it, can double check me? make sure seems right.

a translation matrix (again, let's use identity) this:

[1, 0, x translation element] [0, 1, y translation element] [0, 0, 1] 

first, can not have translation 3x3 matrix 3d space. have use homogeneous 4x4 matrices.

after create separate matrix each transformation (translation, rotation, scale) , multiply them final transformation matrix (multiplying 4x4 matrix give 4x4 matrix)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -