--- ray/src/common/image.c 1992/04/28 09:36:42 2.3 +++ ray/src/common/image.c 1992/12/05 16:23:37 2.6 @@ -1,4 +1,4 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -16,6 +16,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "resolu.h" +#include "paths.h" + VIEW stdview = STDVIEW; /* default view parameters */ @@ -146,13 +148,9 @@ double x, y; if (d > 1.0) return(-1); VCOPY(orig, v->vp); - if (d <= FTINY) { - VCOPY(direc, v->vdir); - return(0); - } d = sqrt(d); z = cos(PI*d); - d = sqrt(1 - z*z)/d; + d = d <= FTINY ? PI : sqrt(1 - z*z)/d; x *= d; y *= d; direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; @@ -376,21 +374,23 @@ int isview(s) /* is this a view string? */ char *s; { - static char *altname[]={NULL,"rpict","rview","pinterp",VIEWSTR,NULL}; - extern char *progname, *rindex(); + static char *altname[]={NULL,VIEWSTR,"rpict","rview","pinterp",NULL}; + extern char *progname; register char *cp; register char **an; /* add program name to list */ - if (altname[0] == NULL) - if ((cp = rindex(progname, '/')) != NULL) - altname[0] = cp+1; - else - altname[0] = progname; + if (altname[0] == NULL) { + for (cp = progname; *cp; cp++) + ; + while (cp > progname && !ISDIRSEP(cp[-1])) + cp--; + altname[0] = cp; + } /* skip leading path */ cp = s; while (*cp && *cp != ' ') cp++; - while (cp > s && cp[-1] != '/') + while (cp > s && !ISDIRSEP(cp[-1])) cp--; for (an = altname; *an != NULL; an++) if (!strncmp(*an, cp, strlen(*an)))