opengl rotation basics?

Started by amoeba, September 21, 2007, 10:33:43

Previous topic - Next topic

amoeba

My Math.todegrees(Math.atan2(y,x)) function seems to be setting 0 degrees to 3 o'clock. Is this right? Also I think its anti-clockwise.

Or is it just my gluLookat code thats wrong?

Kavi

Not sure what you mean - or what you're using it for, but normally "3 o'clock" equals 0 degrees on the unit circle. That is horizontal going right in a 2d cartesian coordinate system (ie. the vector (1, 0)).

And if I completely misunderstood, then.. well i tried :D

amoeba

Yes I think you've answered my question - 0 degrees rotation = 3 o'clock.

Seems weird to me, 0 degrees should be 12 o'clock!

Kavi

Well yes if you think of it as a clock 12 o'clock makes more sense, but I think it was defined with the cartesian coordinates in mind, with the x-axis being the 1st axis and the y-axis being the 2nd. Hence you start your degrees-measurement at (1,0) rather than (0,1) - 12 o'clock. So there is some method to the madness ^^

amoeba

Thanks.

Should 6 o'clock be 270 or 90? Mine seems to be 270 - i.e. direction angle increments anti-clockwise.

Kavi

Yup. That's correct :)
Rotation is anti-clockwise.