1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
– |
|
4 |
|
#include <math.h> |
5 |
|
#include <string.h> |
6 |
|
#include "vect.h" |
8 |
|
#ifndef M_PI |
9 |
|
#define M_PI 3.14159265358979323846 |
10 |
|
#endif |
11 |
+ |
#define PI ((double)M_PI) |
12 |
|
|
13 |
|
#define EPSILON 1e-6 |
14 |
|
|
132 |
|
else if (cos_theta >= +1.0) |
133 |
|
angle = 0.0; |
134 |
|
else |
135 |
< |
angle = (180.0/M_PI) * acos(cos_theta); |
135 |
> |
angle = (180.0/PI) * acos(cos_theta); |
136 |
|
} |
137 |
|
|
138 |
|
return angle; |
162 |
|
{ |
163 |
|
float cosa, sina; |
164 |
|
|
165 |
< |
cosa = cos ((M_PI/180.0) * angle); |
166 |
< |
sina = sin ((M_PI/180.0) * angle); |
165 |
> |
cosa = cos ((PI/180.0) * angle); |
166 |
> |
sina = sin ((PI/180.0) * angle); |
167 |
|
|
168 |
|
switch (axis) { |
169 |
|
case X: |
193 |
|
float cosa, sina; |
194 |
|
Matrix mat; |
195 |
|
|
196 |
< |
cosa = cos ((M_PI/180.0) * angle); |
197 |
< |
sina = sin ((M_PI/180.0) * angle); |
196 |
> |
cosa = cos ((PI/180.0) * angle); |
197 |
> |
sina = sin ((PI/180.0) * angle); |
198 |
|
|
199 |
|
mat[0][0] = (axis[X] * axis[X]) + ((1.0 - (axis[X] * axis[X]))*cosa); |
200 |
|
mat[0][1] = (axis[X] * axis[Y] * (1.0 - cosa)) - (axis[Z] * sina); |
260 |
|
Matrix mat; |
261 |
|
float cosa, sina; |
262 |
|
|
263 |
< |
cosa = cos ((M_PI/180.0) * angle); |
264 |
< |
sina = sin ((M_PI/180.0) * angle); |
263 |
> |
cosa = cos ((PI/180.0) * angle); |
264 |
> |
sina = sin ((PI/180.0) * angle); |
265 |
|
|
266 |
|
mat_identity (mat); |
267 |
|
|
297 |
|
float cosa, sina; |
298 |
|
Matrix mat; |
299 |
|
|
300 |
< |
cosa = cos ((M_PI/180.0) * angle); |
301 |
< |
sina = sin ((M_PI/180.0) * angle); |
300 |
> |
cosa = cos ((PI/180.0) * angle); |
301 |
> |
sina = sin ((PI/180.0) * angle); |
302 |
|
|
303 |
|
mat[0][0] = (axis[X] * axis[X]) + ((1.0 - (axis[X] * axis[X]))*cosa); |
304 |
|
mat[0][1] = (axis[X] * axis[Y] * (1.0 - cosa)) - (axis[Z] * sina); |
422 |
|
} |
423 |
|
|
424 |
|
/* Convert the rotations to degrees */ |
425 |
< |
rotate[X] = (180.0/M_PI)*rotate[X]; |
426 |
< |
rotate[Y] = (180.0/M_PI)*rotate[Y]; |
427 |
< |
rotate[Z] = (180.0/M_PI)*rotate[Z]; |
425 |
> |
rotate[X] = (180.0/PI)*rotate[X]; |
426 |
> |
rotate[Y] = (180.0/PI)*rotate[Y]; |
427 |
> |
rotate[Z] = (180.0/PI)*rotate[Z]; |
428 |
|
} |
429 |
|
|
430 |
|
|