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

Comparing ray/src/cv/mgflib/fvect.c (file contents):
Revision 1.1 by greg, Tue Jun 21 14:45:44 1994 UTC vs.
Revision 1.4 by greg, Fri Feb 28 20:11:29 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1994 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Routines for 3-d vectors
6   */
7  
8   #include <stdio.h>
9 + #include <stdlib.h>
10   #include <math.h>
11   #include "parser.h"
12  
# Line 19 | Line 17 | register FVECT  v;
17   {
18          static double  len;
19          
20 <        len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
20 >        len = DOT(v, v);
21          
22          if (len <= 0.0)
23                  return(0.0);
24          
25 <        len = sqrt(len);
25 >        if (len <= 1.0+FTINY && len >= 1.0-FTINY)
26 >                len = 0.5 + 0.5*len;    /* first order approximation */
27 >        else
28 >                len = sqrt(len);
29  
30          v[0] /= len;
31          v[1] /= len;
# Line 34 | Line 35 | register FVECT  v;
35   }
36  
37  
38 + void
39   fcross(vres, v1, v2)            /* vres = v1 X v2 */
40   register FVECT  vres, v1, v2;
41   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines