Subversion Repositories NaviCtrl

Rev

Rev 256 | Rev 313 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 256 Rev 293
Line 37... Line 37...
37
s16 c_cos_8192(s16 angle)
37
s16 c_cos_8192(s16 angle)
38
{
38
{
39
        return (c_sin_8192(90 - angle));
39
        return (c_sin_8192(90 - angle));
40
}
40
}
Line -... Line 41...
-
 
41
 
-
 
42
// higher resolution angle in deg is arg/div
-
 
43
s16 c_sin_8192_res(s16 arg, s16 div)
-
 
44
{
-
 
45
        s16 angle, rest;
-
 
46
        s32 tmp;
-
 
47
 
-
 
48
        angle = arg/div;
-
 
49
        rest  = arg%div;
-
 
50
 
-
 
51
        if(rest>0)
-
 
52
        {
-
 
53
                tmp = (div-rest)*(s32)c_sin_8192(angle);
-
 
54
                tmp += rest * (s32)c_sin_8192(angle+1);
-
 
55
                tmp /= div;
-
 
56
                return(tmp);
-
 
57
        }
-
 
58
        else if(rest<0)
-
 
59
        {
-
 
60
                tmp = (div+rest)*(s32)c_sin_8192(angle);
-
 
61
                tmp -= rest * (s32)c_sin_8192(angle-1);
-
 
62
                tmp /= div;
-
 
63
                return(tmp);
-
 
64
        }
-
 
65
        else
-
 
66
        {
-
 
67
                return(c_sin_8192(angle));
-
 
68
        }
-
 
69
 
-
 
70
}
-
 
71
 
-
 
72
s16 c_cos_8192_res(s16 arg, s16 div)
-
 
73
{
-
 
74
        return(c_sin_8192_res(90*div - arg, div));
-
 
75
}
-
 
76
 
41
 
77
 
42
// integer based atan2 that returns angle in counts of 1/546.13°  
78
// integer based atan2 that returns angle in counts of 1/546.13°  
43
s32 c_tan2_546(s32 y, s32 x)
79
s32 c_atan2_546(s32 y, s32 x)
44
{
80
{
Line 45... Line 81...
45
        s32 qx, qy, q;
81
        s32 qx, qy, q;
46
       
82