|
Atan2 problem RVamzess from Poland [2 posts] |
16 year
|
Hello,
I thought i know how atan2 works, but i am very surrprised. Results that i get are strange. Please help me and let me know:
-how to obtaint an angle for a strait line (i know its directional rate - gradient) in the first quarter of coordinate arrangement, or
-how atan2 exactly works, or
-at last how to calculate arcus tangens in other way.
Thanks in advance.
|
|
|
Anonymous |
16 year
|
Yea, it is a little confusing once you first start working with it. We basically just mapped the C++ version of atan2. For more description on that have a look at
http://www.cplusplus.com/reference/clibrary/cmath/atan2.html
Some tips are:
- Convert to degrees
(atan2(100,100)*180.0f)/3.14159
- Convert to 0 - 2PI range
deg = atan2(100,100)
if deg < 0 then deg = 6.2831853 + deg
- Convert to 0 - 360 range
deg = (atan2(100,100)*180.0f)/3.1415927
if deg < 0 then deg = 6.2831853 + deg
STeven.
|
|
|
RVamzess from Poland [2 posts] |
16 year
|
Thanks a lot indeed Steven!
The problem is solved now!
RVamzess
|
|