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

Comparing ray/src/rt/func.c (file contents):
Revision 1.17 by greg, Mon Jun 17 08:51:33 1991 UTC vs.
Revision 1.20 by greg, Wed Jul 17 10:09:24 1991 UTC

# Line 33 | Line 33 | OBJREC  *m;
33   register RAY  *r;
34   XF  *bx;
35   {
36 <        extern double  l_arg();
36 >        extern double  l_arg(), l_erf(), l_erfc();
37          extern long  eclock;
38          static char  *initfile = "rayinit.cal";
39          static long  lastrno = -1;
# Line 42 | Line 42 | XF  *bx;
42                  return(0);
43                                          /* initialize if first call */
44          if (initfile != NULL) {
45                loadfunc(initfile);
45                  scompile("Dx=$1;Dy=$2;Dz=$3;", NULL, 0);
46                  scompile("Nx=$4;Ny=$5;Nz=$6;", NULL, 0);
47                  scompile("Px=$7;Py=$8;Pz=$9;", NULL, 0);
# Line 52 | Line 51 | XF  *bx;
51                  scompile("Jx=$19;Jy=$20;Jz=$21;", NULL, 0);
52                  scompile("Kx=$22;Ky=$23;Kz=$24;", NULL, 0);
53                  funset("arg", 1, '=', l_arg);
54 +                funset("erf", 1, ':', l_erf);
55 +                funset("erfc", 1, ':', l_erfc);
56                  setnoisefuncs();
57 +                loadfunc(initfile);
58                  initfile = NULL;
59          }
60          fobj = m;
# Line 137 | Line 139 | l_arg()                                /* return nth real argument */
139  
140  
141   double
142 + l_erf()                         /* error function */
143 + {
144 +        extern double  erf();
145 +
146 +        return(erf(argument(1)));
147 + }
148 +
149 +
150 + double
151 + l_erfc()                        /* cumulative error function */
152 + {
153 +        extern double  erfc();
154 +
155 +        return(erfc(argument(1)));
156 + }
157 +
158 +
159 + double
160   chanvalue(n)                    /* return channel n to calcomp */
161   register int  n;
162   {
# Line 175 | Line 195 | register int  n;
195                  return(sum * funcxf.sca);
196  
197          }
198 <        if (n == 10)                    /* dot product */
199 <                return(fray->rod);
198 >        if (n == 10)                    /* dot product (range [-1,1]) */
199 >                return( fray->rod <= -1.0 ? -1.0 :
200 >                        fray->rod >= 1.0 ? 1.0 :
201 >                        fray->rod );
202  
203          if (n == 11)                    /* scale */
204                  return(funcxf.sca);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines