Subversion Repositories FlightCtrl

Rev

Rev 178 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 178 Rev 179
Line 21... Line 21...
21
//-----------------------------------------------
21
//-----------------------------------------------
22
signed int arctan_i(signed int x, signed int y)
22
signed int arctan_i(signed int x, signed int y)
23
{  
23
{  
24
   float rad,r;
24
   float rad,r;
25
   signed int angle;
25
   signed int angle;
-
 
26
   short int m;  
Line -... Line 27...
-
 
27
   
Line 26... Line 28...
26
   
28
   if (!x && !y) return 0;
27
   
29
   
28
   if ( !x && !y) return 0;
30
   if (y < 0)
-
 
31
   {
-
 
32
      y = abs(y);
-
 
33
      m = -1;                   // neg. für Quadrant III + IV
-
 
34
   }
Line 29... Line 35...
29
   
35
   else m = 1;
30
   y = abs(y);
36
       
31
   
37
   
32
   if (x>=0)
38
   if (x>=0)
Line 39... Line 45...
39
      r = (x + y) / (y - x);
45
      r = (x + y) / (y - x);
40
      rad = 0.1963*r*r*r - 0.9817*r + 2.3562;
46
      rad = 0.1963*r*r*r - 0.9817*r + 2.3562;
41
   }
47
   }
Line 42... Line 48...
42
   
48
   
43
   angle = (360 * rad) / 6.2832;
49
   angle = (360 * rad) / 6.2832;
44
   
-
 
45
   if (y < 0) return(-angle);     // negate if in quad III or IV
50
     
46
   else return(angle);
51
   return(angle*m);
Line 47... Line 52...
47
}
52
}
48
 
53
 
49
// cosinus Funktion: Eingabewert Winkel in Grad, Rueckgabe =cos(winkel)*1000
54
// cosinus Funktion: Eingabewert Winkel in Grad, Rueckgabe =cos(winkel)*1000