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 2.9 by greg, Tue May 25 10:30:16 1993 UTC vs.
Revision 2.13 by greg, Thu Nov 2 17:38:05 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1992 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ LBL";
18  
19  
20   #define  INITFILE       "rayinit.cal"
21 #define  REFVNAME       "`FILE_REFCNT"
21   #define  CALSUF         ".cal"
22   #define  LCALSUF        4
23 + char  REFVNAME[] = "`FILE_REFCNT";
24  
25   XF  unitxf = {                  /* identity transform */
26          {{1.0, 0.0, 0.0, 0.0},
# Line 69 | Line 69 | int  dofwd;
69                  funset("erf", 1, ':', l_erf);
70                  funset("erfc", 1, ':', l_erfc);
71                  setnoisefuncs();
72 +                setprismfuncs();
73                  loadfunc(initfile);
74                  initfile[0] = '\0';
75          }
# Line 195 | Line 196 | register RAY  *r;
196   loadfunc(fname)                 /* load definition file */
197   char  *fname;
198   {
199 <        extern char  *libpath;          /* library search path */
199 >        extern char  *getlibpath();     /* library search path */
200          char  *ffname;
201  
202 <        if ((ffname = getpath(fname, libpath, R_OK)) == NULL) {
202 >        if ((ffname = getpath(fname, getlibpath(), R_OK)) == NULL) {
203                  sprintf(errmsg, "cannot find function file \"%s\"", fname);
204                  error(USER, errmsg);
205          }
# Line 250 | Line 251 | double
251   chanvalue(n)                    /* return channel n to calcomp */
252   register int  n;
253   {
253        double  sum;
254        register RAY  *r;
255
254          if (fray == NULL)
255                  syntax("ray parameter used in constant expression");
256  
# Line 280 | Line 278 | register int  n;
278                                  fray->rop[2]*funcxf.xfm[2][n-6] +
279                                               funcxf.xfm[3][n-6] );
280  
281 <        if (n == 9) {                   /* total distance */
282 <                sum = fray->rot;
285 <                for (r = fray->parent; r != NULL; r = r->parent)
286 <                        sum += r->rot;
287 <                return(sum * funcxf.sca);
281 >        if (n == 9)                     /* total distance */
282 >                return(raydist(fray,PRIMARY) * funcxf.sca);
283  
289        }
290
284          if (n == 10)                    /* dot product (range [-1,1]) */
285                  return( fray->rod <= -1.0 ? -1.0 :
286                          fray->rod >= 1.0 ? 1.0 :
# Line 308 | Line 301 | register int  n;
301          if (n < 24)                     /* k unit vector */
302                  return(funcxf.xfm[2][n-21] / funcxf.sca);
303  
304 <        if (n == 24) {                  /* single ray (shadow) distance */
305 <                sum = fray->rot;
313 <                for (r = fray->parent; r != NULL && r->crtype&SHADOW;
314 <                                r = r->parent)
315 <                        sum += r->rot;
316 <                return(sum * funcxf.sca);
317 <        }
304 >        if (n == 24)                    /* single ray (shadow) distance */
305 >                return((fray->rot+raydist(fray->parent,SHADOW)) * funcxf.sca);
306   badchan:
307          error(USER, "illegal channel number");
308   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines