--- ray/src/rt/func.c 1991/05/24 13:52:10 1.15 +++ ray/src/rt/func.c 1991/06/18 08:59:52 1.18 @@ -36,6 +36,10 @@ XF *bx; extern double l_arg(); extern long eclock; static char *initfile = "rayinit.cal"; + static long lastrno = -1; + /* check to see if already set */ + if (m == fobj && r->rno == lastrno) + return(0); /* initialize if first call */ if (initfile != NULL) { loadfunc(initfile); @@ -61,7 +65,9 @@ XF *bx; copystruct(&funcxf, &r->rox->b); else copystruct(&funcxf, bx); + lastrno = r->rno; eclock++; /* notify expression evaluator */ + return(1); } @@ -91,8 +97,7 @@ RAY *r; } m->os = (char *)mxf; } - setmap(m, r, mxf); - return; + return(setmap(m, r, mxf)); memerr: error(SYSTEM, "out of memory in setfunc"); } @@ -170,8 +175,10 @@ register int n; return(sum * funcxf.sca); } - if (n == 10) /* dot product */ - return(fray->rod); + if (n == 10) /* dot product (range [-1,1]) */ + return( fray->rod <= -1.0 ? -1.0 : + fray->rod >= 1.0 ? 1.0 : + fray->rod ); if (n == 11) /* scale */ return(funcxf.sca);