### Author Topic: Matrix.rotateX rotates clockwise  (Read 5663 times)

#### Emmanuel

• byte
• Posts: 5
##### Matrix.rotateX rotates clockwise
« on: June 30, 2013, 10:10:22 pm »
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:
Code: [Select]
`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

• Posts: 12239
##### Re: Matrix.rotateX rotates clockwise
« Reply #1 on: June 30, 2013, 10:20:34 pm »
I think you are right. I'll change the docs for the next release.

#### Emmanuel

• byte
• Posts: 5
##### Re: Matrix.rotateX rotates clockwise
« Reply #2 on: July 01, 2013, 11:12:37 am »
Thanks for the quick response.

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

#### EgonOlsen

• Posts: 12239
##### Re: Matrix.rotateX rotates clockwise
« Reply #3 on: July 04, 2013, 08:58:17 pm »
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

• byte
• Posts: 5
##### Re: Matrix.rotateX rotates clockwise
« Reply #4 on: July 08, 2013, 11:14:19 am »
I have to disagree going from (0 1 0 0) to (0 0 -1 0) is clockwise. (I am "looking" from positive X)

#### EgonOlsen

• Posts: 12239
##### Re: Matrix.rotateX rotates clockwise
« Reply #5 on: July 08, 2013, 12:13:52 pm »
"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

• byte
• Posts: 5
##### Re: Matrix.rotateX rotates clockwise
« Reply #6 on: July 08, 2013, 12:31:46 pm »
Yes I am looking at the origin from a positive X value because rotation axis is positive X

#### EgonOlsen

• Posts: 12239
##### Re: Matrix.rotateX rotates clockwise
« Reply #7 on: July 08, 2013, 12:46:49 pm »
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

• byte
• Posts: 5
##### Re: Matrix.rotateX rotates clockwise
« Reply #8 on: July 08, 2013, 03:00:24 pm »
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