Thanks Geometrian for posting that code. I haven't worked in C++ for about a year so I will have to take a bit of time to dig into that and see what I can glean from it.

Since my post I have found a few more examples and articles but I am still a bit off on my calculatios. I am sure some will laugh but the formula I found that cracked everything open was **not** a formula to create the matrix but a formula that allowed one to pull the degrees of rotation out of the matrix. I took it and just reversed it, then from there I knew where to place the results and I figured out matrix multiplicaion.

But like I said things are bit off. There are some built in functions for simplifing rotation (they are limiting what I can do), and I am comparing my numbers to them. If I just rotate on one axis the numbers are fine it is when I rotate on more than one that things get messed up.

I have my code outputing the numbers from the built in rotation fuctions (first matrix below) and from my calculations (second matrix below), here's what I am seeing

X: 2deg Y: 2deg 0.9993908270190958, 0.001217974870087876, -0.03487823687206265, 0, 0, 0.9993908270190958, 0.03489949670250097, 0, 0.03489949670250097, -0.03487823687206265, 0.9987820251299122, 0, 99.93908270190957, 100.06088018891836, 0.002125983043832047, 1 X cosine: 0.9993908270190958 X sine: 0.03489949670250097 Y cosine: 0.9993908270190958 Y sine: 0.03489949670250097 0.9993908270190958, 0, -0.03489949670250097, 0, 0.001217974870087876, 0.9993908270190958, 0.03487823687206265, 0, 0.03487823687206265, -0.03489949670250097, 0.9987820251299122, 0, 100, 100, 0, 1

Note that there is a 100 translate on both the X and Y axis so I can throughtly test my numbers.

I looks like the X and Y cosine and sine calculations are correct but something is not being calculated correctly after that. Nor is the calculation being applies to the translate values (I suspect I need to just research a bit to solve this). Hmm, as I look a little closer it looks like maybe some numbers are in the wrong spot ... but why?

Here is a pseudo version of the code I currently have

basematrix = [ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [100, 100, 0, 1] ]; function RotateMatrix(y, x) { halfrot = 3.141592653589793 / 180; // pi divided by 180 xcos = cos(x * halfrot); xsin = sin(x * halfrot); ycos = cos(y * halfrot); ysin = sin(y * halfrot); ymatrix = [ [ycos, 0, -ysin, 0], [0, 1, 0, 0], [ysin, 0, ycos, 0], [0, 0, 0, 1] ]; xmatrix = [ [1, 0, 0, 0], [0, xcos, xsin, 0], [0, -xsin, xcos, 0], [0, 0, 0, 1] ]; calcmatrix = MatrixMultiply(ymatrix, basematrix); calcmatrix = MatrixMultiply(xmatrix, calcmatrix); for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { //output calcmatrix[i][j] } } } function MatrixMultiply(matrixa, matrixb) { newmatrix = []; for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) { newmatrix[i][j] = matrixa[i][0] * matrixb[0][j] + matrixa[i][1] * matrixb[1][j] + matrixa[i][2] * matrixb[2][j] + matrixa[i][3] * matrixb[3][j]; } } return newmatrix; }

Maybe someone can see what I did wrong.