--- ray/src/rt/rv2.c 2018/11/13 19:58:33 2.69 +++ ray/src/rt/rv2.c 2021/11/14 17:30:02 2.73 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rv2.c,v 2.69 2018/11/13 19:58:33 greg Exp $"; +static const char RCSid[] = "$Id: rv2.c,v 2.73 2021/11/14 17:30:02 greg Exp $"; #endif /* * rv2.c - command routines used in tracing a view. @@ -483,7 +483,6 @@ getexposure( /* get new exposure */ } typedef union {int i; double d; COLOR C;} *MyUptr; -#define FEQ(x,y) (fabs((x)-(y)) <= FTINY) int getparam( /* get variable from user */ @@ -521,7 +520,7 @@ getparam( /* get variable from user */ if (sscanf(buf, "%lf", &d0) != 1) return(0); } - if (FEQ(ptr->d, d0)) + if (FABSEQ(ptr->d, d0)) return(0); ptr->d = d0; break; @@ -553,9 +552,9 @@ getparam( /* get variable from user */ if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3) return(0); } - if (FEQ(colval(ptr->C,RED), d0) && - FEQ(colval(ptr->C,GRN), d1) && - FEQ(colval(ptr->C,BLU), d2)) + if (FABSEQ(colval(ptr->C,RED), d0) && + FABSEQ(colval(ptr->C,GRN), d1) && + FABSEQ(colval(ptr->C,BLU), d2)) return(0); setcolor(ptr->C, d0, d1, d2); break; @@ -793,7 +792,7 @@ traceray( /* trace a single ray */ matspec[0] = '\0'; if (thisray.ro->omod != OVOID) { mod = objptr(thisray.ro->omod); - mat = findmaterial(mod); + mat = findmaterial(thisray.ro); } if (thisray.rod < 0.0) strcpy(matspec, "back of "); @@ -812,7 +811,7 @@ traceray( /* trace a single ray */ ofun[ino->otype].funame, ino->oname); (*dev->comout)(buf); (*dev->comin)(buf, NULL); - if (thisray.rot >= FHUGE) + if (thisray.rot >= FHUGE*.99) (*dev->comout)("at infinity"); else { sprintf(buf, "at (%.6g %.6g %.6g) (%.6g)", @@ -871,6 +870,7 @@ writepict( /* write the picture to a file */ fputexpos(exposure, fp); if (dev->pixaspect != 1.0) fputaspect(dev->pixaspect, fp); + fputprims(stdprims, fp); fputformat(COLRFMT, fp); putc('\n', fp); fprtresolu(hresolu, vresolu, fp);