| 36 |
|
extern double l_arg(); |
| 37 |
|
extern long eclock; |
| 38 |
|
static char *initfile = "rayinit.cal"; |
| 39 |
+ |
static long lastrno = -1; |
| 40 |
+ |
/* check to see if already set */ |
| 41 |
+ |
if (m == fobj && r->rno == lastrno) |
| 42 |
+ |
return(0); |
| 43 |
|
/* initialize if first call */ |
| 44 |
|
if (initfile != NULL) { |
| 45 |
|
loadfunc(initfile); |
| 65 |
|
copystruct(&funcxf, &r->rox->b); |
| 66 |
|
else |
| 67 |
|
copystruct(&funcxf, bx); |
| 68 |
+ |
lastrno = r->rno; |
| 69 |
|
eclock++; /* notify expression evaluator */ |
| 70 |
+ |
return(1); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 97 |
|
} |
| 98 |
|
m->os = (char *)mxf; |
| 99 |
|
} |
| 100 |
< |
setmap(m, r, mxf); |
| 95 |
< |
return; |
| 100 |
> |
return(setmap(m, r, mxf)); |
| 101 |
|
memerr: |
| 102 |
|
error(SYSTEM, "out of memory in setfunc"); |
| 103 |
|
} |
| 175 |
|
return(sum * funcxf.sca); |
| 176 |
|
|
| 177 |
|
} |
| 178 |
< |
if (n == 10) /* dot product */ |
| 179 |
< |
return(fray->rod); |
| 178 |
> |
if (n == 10) /* dot product (range [-1,1]) */ |
| 179 |
> |
return( fray->rod <= -1.0 ? -1.0 : |
| 180 |
> |
fray->rod >= 1.0 ? 1.0 : |
| 181 |
> |
fray->rod ); |
| 182 |
|
|
| 183 |
|
if (n == 11) /* scale */ |
| 184 |
|
return(funcxf.sca); |