I convert the angle (In range of 0-360) to a radian and log the output in a txt file. the output is below.
Note the dramatic change in output from angle 1 to angle 2.
Here's my degree to radian function,
Code: Select all
const float PI = 3.14159265;
inline float DegToRad(float ang)
{
return ang*180.0f/PI;
}
Code: Select all
Angle:1
Cos Output:0.733657
Angle:2
Cos Output:0.076504
Angle:3
Cos Output:-0.621401
Angle:4
Cos Output:-0.988294
Angle:5
Cos Output:-0.828736
Angle:6
Cos Output:-0.227722
Angle:7
Cos Output:0.494597
Angle:8
Cos Output:0.953451
Angle:9
Cos Output:0.904414
Angle:10
Cos Output:0.373608
Angle:11
Cos Output:-0.356214
Angle:12
Cos Output:-0.896286
Angle:13
Cos Output:-0.958918
Angle:14
Cos Output:-0.510747
Angle:15
Cos Output:0.209491
Angle:16
Cos Output:0.818137
Angle:17
Cos Output:0.990972
Angle:18
Cos Output:0.635929
Angle:19
Cos Output:-0.057864
Angle:20
Cos Output:-0.720834
Angle:21
Cos Output:-0.999825
Angle:22
Cos Output:-0.746223
Angle:23
Cos Output:-0.095118
Angle:24
Cos Output:0.606656
Angle:25
Cos Output:0.985272
Angle:26
Cos Output:0.839047
Angle:27
Cos Output:0.245873
Angle:28
Cos Output:-0.478274
Angle:29
Cos Output:-0.947651
Angle:30
Cos Output:-0.912227
Angle:31
Cos Output:-0.390871
Angle:32
Cos Output:0.338696
Angle:33
Cos Output:0.887844
Angle:34
Cos Output:0.964050
Angle:35
Cos Output:0.526719
Angle:36
Cos Output:-0.191188
Angle:37
Cos Output:-0.807324
Angle:38
Cos Output:-0.993303
Angle:39
Cos Output:-0.650143
Angle:40
Cos Output:0.039204
Angle:41
Cos Output:0.707846
Angle:42
Cos Output:0.999302
Angle:43
Cos Output:0.758450
Angle:44
Cos Output:0.113698
Angle:45
Cos Output:-0.591797
Angle:46
Cos Output:-0.981905
Angle:47
Cos Output:-0.849000
Angle:48
Cos Output:-0.263938
Angle:49
Cos Output:0.461893
Angle:50
Cos Output:0.941520
Angle:51
Cos Output:0.919673
Angle:52
Cos Output:0.407999
Angle:53
Cos Output:-0.321175
Angle:54
Cos Output:-0.879093
Angle:55
Cos Output:-0.968816
Angle:56
Cos Output:-0.542507
Angle:57
Cos Output:0.172938
Angle:58
Cos Output:0.796085
Angle:59
Cos Output:0.995277
Angle:60
Cos Output:0.664315
Angle:61
Cos Output:-0.020652
Angle:62
Cos Output:-0.694439
Angle:63
Cos Output:-0.998437
Angle:64
Cos Output:-0.770570
Angle:65
Cos Output:-0.132117
Angle:66
Cos Output:0.576535
Angle:67
Cos Output:0.978221
Angle:68
Cos Output:0.858785
Angle:69
Cos Output:0.281794
Angle:70
Cos Output:-0.445134
Angle:71
Cos Output:-0.935105
Angle:72
Cos Output:-0.926894
Angle:73
Cos Output:-0.424873
Angle:74
Cos Output:0.303543
Angle:75
Cos Output:0.869975
Angle:76
Cos Output:0.973304
Angle:77
Cos Output:0.558005
Angle:78
Cos Output:-0.154628
Angle:79
Cos Output:-0.784867
Angle:80
Cos Output:-0.996926
Angle:81
Cos Output:-0.678073
Angle:82
Cos Output:0.002093
Angle:83
Cos Output:0.681144
Angle:84
Cos Output:0.997209
Angle:85
Cos Output:0.782267
Angle:86
Cos Output:0.150492
Angle:87
Cos Output:-0.561473
Angle:88
Cos Output:-0.974146
Angle:89
Cos Output:-0.868146
Angle:90
Cos Output:-0.299553
Angle:91
Cos Output:0.428658
Angle:92
Cos Output:0.928276
Angle:93
Cos Output:0.933701
Angle:94
Cos Output:0.441601
Angle:95
Cos Output:-0.285807
Angle:96
Cos Output:-0.860674
Angle:97
Cos Output:-0.977396
Angle:98
Cos Output:-0.573310
Angle:99
Cos Output:0.136265
Angle:100
Cos Output:0.772922
Angle:101
Cos Output:0.998208
Angle:102
Cos Output:0.691597
Angle:103
Cos Output:0.016467
Angle:104
Cos Output:-0.667074
Angle:105
Cos Output:-0.995652
Angle:106
Cos Output:-0.793693
Angle:107
Cos Output:-0.168814
Angle:108
Cos Output:0.545610
Angle:109
Cos Output:0.969785
Angle:110
Cos Output:0.877208
Angle:111
Cos Output:0.317208
Angle:112
Cos Output:-0.411371
Angle:113
Cos Output:-0.921214
Angle:114
Cos Output:-0.940185
Angle:115
Cos Output:-0.458176
Angle:116
Cos Output:0.267502
Angle:117
Cos Output:0.851076
Angle:118
Cos Output:0.981151
Angle:119
Cos Output:0.588418
Angle:120
Cos Output:-0.117371
Angle:121
Cos Output:-0.761012
Angle:122
Cos Output:-0.999147
Angle:123
Cos Output:-0.704884
Angle:124
Cos Output:-0.035509
Angle:125
Cos Output:0.653133
Angle:126
Cos Output:0.993751
Angle:127
Cos Output:0.804847
Angle:128
Cos Output:0.187557
Angle:129
Cos Output:-0.529962
Angle:130
Cos Output:-0.965090
Angle:131
Cos Output:-0.885967
Angle:132
Cos Output:-0.335215
Angle:133
Cos Output:0.394384
Angle:134
Cos Output:0.913834
Angle:135
Cos Output:0.946346
Angle:136
Cos Output:0.475024
Angle:137
Cos Output:-0.249573
Angle:138
Cos Output:-0.841185
Angle:139
Cos Output:-0.984569
Angle:140
Cos Output:-0.603712
Angle:141
Cos Output:0.098919
Angle:142
Cos Output:0.748841
Angle:143
Cos Output:0.999752
Angle:144
Cos Output:0.718267
Angle:145
Cos Output:0.054051
Angle:146
Cos Output:-0.638966
Angle:147
Cos Output:-0.991508
Angle:148
Cos Output:-0.815723
Angle:149
Cos Output:-0.205277
Angle:150
Cos Output:0.513713
Angle:151
Cos Output:0.959926
Angle:152
Cos Output:0.894640
Angle:153
Cos Output:0.352643
Angle:154
Cos Output:-0.377261
Angle:155
Cos Output:-0.906140
Angle:156
Cos Output:-0.952180
Angle:157
Cos Output:-0.490849
Angle:158
Cos Output:0.232033
Angle:159
Cos Output:0.830732
Angle:160
Cos Output:0.987723
Angle:161
Cos Output:0.618404
Angle:162
Cos Output:-0.080434
Angle:163
Cos Output:-0.736412
Angle:164
Cos Output:-0.999991
Angle:165
Cos Output:-0.730723
Angle:166
Cos Output:-0.072087
Angle:167
Cos Output:0.624198
Angle:168
Cos Output:0.988851
Angle:169
Cos Output:0.826593
Angle:170
Cos Output:0.223882
Angle:171
Cos Output:-0.498125
Angle:172
Cos Output:-0.954705
Angle:173
Cos Output:-0.902568
Angle:174
Cos Output:-0.369495
Angle:175
Cos Output:0.359552
Angle:176
Cos Output:0.897919
Angle:177
Cos Output:0.957827
Angle:178
Cos Output:0.507355
Angle:179
Cos Output:-0.213463
Angle:180
Cos Output:-0.820536
Code: Select all
while(1)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
//vcam->Move(0,0,0);
// vcam->Other(joy->_x,0,joy->_y);
glLoadIdentity();
joy->Update();
cy++;
if(cy>360) cy=0;
//vcam->Rotate(cp,cy,0);
//FontRenderer->RenderText(0,0,"Gui Test Alpha 1");
Renderer->RenderScene();
sys->Draw2D();
if( !(yawtxt == NULL ) )
{
free( (void *)yawtxt );
}
angtxt = StringUtil->Num( (int)cy );
yawtxt = StringUtil->Num( (float)cos(DegToRad(cy)) );
FontRenderer->RenderText( 0,0,angtxt );
FontRenderer->RenderText( 0,20,yawtxt );
Logger->Log("Angle:%s Cos Output:%s \n",angtxt,yawtxt );
// sys->Draw2D();
if(joy->_select==1)
{
sceKernelExitGame();
}
if( joy->_rtrigger )
{
screenshot("mplay");
}
glutSwapBuffers();
}