ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/vect.c
(Generate patch)

Comparing ray/src/cv/mgflib/vect.c (file contents):
Revision 1.1 by greg, Thu Feb 8 11:08:05 1996 UTC vs.
Revision 1.3 by greg, Fri Feb 28 20:11:30 2003 UTC

# Line 1 | Line 1
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"
# Line 9 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
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  
# Line 132 | Line 132 | float vect_angle (Vector v1, Vector v2)
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;
# Line 162 | Line 162 | void vect_rotate (Vector v1, Vector v2, int axis, floa
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:
# Line 193 | Line 193 | void vect_axis_rotate (Vector v1, Vector v2, Vector ax
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);
# Line 260 | Line 260 | void mat_rotate (Matrix mat1, Matrix mat2, int axis, f
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  
# Line 297 | Line 297 | void mat_axis_rotate (Matrix mat1, Matrix mat2, Vector
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);
# Line 422 | Line 422 | void mat_decode (Matrix mat, Vector scale,  Vector she
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines