Hello Guest

opengl rotation basics?

  • 5 Replies
  • 10945 Views
opengl rotation basics?
« on: September 21, 2007, 10:33:43 »
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?

Re: opengl rotation basics?
« Reply #1 on: September 21, 2007, 17:21:22 »
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

Re: opengl rotation basics?
« Reply #2 on: September 21, 2007, 20:30:47 »
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!

Re: opengl rotation basics?
« Reply #3 on: September 22, 2007, 00:41:52 »
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 ^^

Re: opengl rotation basics?
« Reply #4 on: September 22, 2007, 10:11:55 »
Thanks.

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

Re: opengl rotation basics?
« Reply #5 on: September 22, 2007, 13:20:25 »
Yup. That's correct :)
Rotation is anti-clockwise.