9 |
|
#ifndef M_PI |
10 |
|
#define M_PI 3.14159265358979323846 |
11 |
|
#endif |
12 |
+ |
#define PI ((double)M_PI) |
13 |
|
|
14 |
|
#define EPSILON 1e-6 |
15 |
|
|
133 |
|
else if (cos_theta >= +1.0) |
134 |
|
angle = 0.0; |
135 |
|
else |
136 |
< |
angle = (180.0/M_PI) * acos(cos_theta); |
136 |
> |
angle = (180.0/PI) * acos(cos_theta); |
137 |
|
} |
138 |
|
|
139 |
|
return angle; |
163 |
|
{ |
164 |
|
float cosa, sina; |
165 |
|
|
166 |
< |
cosa = cos ((M_PI/180.0) * angle); |
167 |
< |
sina = sin ((M_PI/180.0) * angle); |
166 |
> |
cosa = cos ((PI/180.0) * angle); |
167 |
> |
sina = sin ((PI/180.0) * angle); |
168 |
|
|
169 |
|
switch (axis) { |
170 |
|
case X: |
194 |
|
float cosa, sina; |
195 |
|
Matrix mat; |
196 |
|
|
197 |
< |
cosa = cos ((M_PI/180.0) * angle); |
198 |
< |
sina = sin ((M_PI/180.0) * angle); |
197 |
> |
cosa = cos ((PI/180.0) * angle); |
198 |
> |
sina = sin ((PI/180.0) * angle); |
199 |
|
|
200 |
|
mat[0][0] = (axis[X] * axis[X]) + ((1.0 - (axis[X] * axis[X]))*cosa); |
201 |
|
mat[0][1] = (axis[X] * axis[Y] * (1.0 - cosa)) - (axis[Z] * sina); |
261 |
|
Matrix mat; |
262 |
|
float cosa, sina; |
263 |
|
|
264 |
< |
cosa = cos ((M_PI/180.0) * angle); |
265 |
< |
sina = sin ((M_PI/180.0) * angle); |
264 |
> |
cosa = cos ((PI/180.0) * angle); |
265 |
> |
sina = sin ((PI/180.0) * angle); |
266 |
|
|
267 |
|
mat_identity (mat); |
268 |
|
|
298 |
|
float cosa, sina; |
299 |
|
Matrix mat; |
300 |
|
|
301 |
< |
cosa = cos ((M_PI/180.0) * angle); |
302 |
< |
sina = sin ((M_PI/180.0) * angle); |
301 |
> |
cosa = cos ((PI/180.0) * angle); |
302 |
> |
sina = sin ((PI/180.0) * angle); |
303 |
|
|
304 |
|
mat[0][0] = (axis[X] * axis[X]) + ((1.0 - (axis[X] * axis[X]))*cosa); |
305 |
|
mat[0][1] = (axis[X] * axis[Y] * (1.0 - cosa)) - (axis[Z] * sina); |
423 |
|
} |
424 |
|
|
425 |
|
/* Convert the rotations to degrees */ |
426 |
< |
rotate[X] = (180.0/M_PI)*rotate[X]; |
427 |
< |
rotate[Y] = (180.0/M_PI)*rotate[Y]; |
428 |
< |
rotate[Z] = (180.0/M_PI)*rotate[Z]; |
426 |
> |
rotate[X] = (180.0/PI)*rotate[X]; |
427 |
> |
rotate[Y] = (180.0/PI)*rotate[Y]; |
428 |
> |
rotate[Z] = (180.0/PI)*rotate[Z]; |
429 |
|
} |
430 |
|
|
431 |
|
|