I am using UIAcceleration
for rotation. I have opposite side, adjacent side, but I want to calculate tan-1(y/x) inverse tan.
views:
995answers:
4
+4
A:
The standard C math.h functions are available:
#include <math.h>
...
float theta = atan2f(y, x);
...
Louis Gerbarg
2009-07-20 10:20:03
Note that in most atan2 functions, Y is the first parameter, not X
Sean
2009-07-20 21:13:38
You are correct, fixed.
Louis Gerbarg
2009-07-21 01:13:29
+3
A:
atan2(y, x)
is the same thing as atan(y/x)
, but it can deal properly with the case where x = 0
(i.e. a vertical line going up or down) without having do deal with positive vs. negative infinity.
David Maymudes
2009-07-20 13:29:26
i got lazy and followed the other 2 answ w/o looking it up. thanks for the prod. :-)
Jason S
2009-07-20 21:28:56