Matrix.rotateX rotates clockwise

Started by Emmanuel, June 30, 2013, 10:10:22 PM

Previous topic - Next topic

Emmanuel

Hello,

Thanks for your work. I think I might have encountered a misleading method description. Indeed the doc says rotateX creates a counter-clockwise rotation for positive angles but it appears to create a clockwise rotation matrix.

How you can test:

Matrix mat = new Matrix();
mat.rotateX((float)Math.PI/2);
Logger.Log(mat.ToString());


You get the matrix:
1  0  0  0
0  0  -1 0
0  1  0  0
0  0  0  1
Which sends (0  1  0  0) to (0  0  -1  0). (I'm assuming row vectors)
Which corresponds to clockwise

EgonOlsen

I think you are right. I'll change the docs for the next release.

Emmanuel

Thanks for the quick response.

BTW, I believe rotateY and rotateZ also have the same problem.

EgonOlsen

Thinking about this again, i think that the docs are correct. (0  1  0  0) to (0  0  -1  0) means that a vector pointing down now points to the front which is, when viewed along the x-axis, a counter clockwise rotation, isn't it?

Emmanuel

I have to disagree going from (0 1 0 0) to (0 0 -1 0) is clockwise. (I am "looking" from positive X)

EgonOlsen

"From positive X" means that you are looking at the origin from some x-value? If that's the case, i would say that you are looking into the wrong direction... ???

Emmanuel

Yes I am looking at the origin from a positive X value because rotation axis is positive X

EgonOlsen

I'm not sure if there is an "official" way of looking along axes, but to me, this is the wrong direction. To me, that's like saying that my left hand is actually my right one, because somebody who is looking at me sees it that way. However, i can add this little detail to the docs and we both should be happy...!?

Emmanuel

Ok thanks a lot.
You might want to know there is a mathematical convention. ANYWAY
If everybody likes it that way its great
Love the engine, just wanted to help.
Thanks again