--- ray/src/common/image.c 2008/12/12 22:05:38 2.35 +++ ray/src/common/image.c 2012/11/16 00:14:19 2.38 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: image.c,v 2.35 2008/12/12 22:05:38 greg Exp $"; +static const char RCSid[] = "$Id: image.c,v 2.38 2012/11/16 00:14:19 greg Exp $"; #endif /* * image.c - routines for image generation. @@ -221,9 +221,8 @@ double y y *= sqrt(v->vn2); d = x*x + y*y; z = (1. - d)/(1. + d); - d = d <= FTINY*FTINY ? PI : sqrt((1.0 - z*z)/d); - x *= d; - y *= d; + x *= (1. + z); + y *= (1. + z); direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; @@ -308,9 +307,8 @@ FVECT p return; if (d <= -(1.0-FTINY)) return; /* really an error */ - d = sqrt(1.0 - d*d) / (1.0 + d); - ip[0] += DOT(disp,v->hvec)*d/sqrt(v->hn2); - ip[1] += DOT(disp,v->vvec)*d/sqrt(v->vn2); + ip[0] += DOT(disp,v->hvec)/((1. + d)*sqrt(v->hn2)); + ip[1] += DOT(disp,v->vvec)/((1. + d)*sqrt(v->vn2)); return; } ip[0] = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff; @@ -326,7 +324,7 @@ int px, int py ) { - register int x, y; + int x, y; if (rp->rt & YMAJOR) { x = px; @@ -352,10 +350,11 @@ double lx, double ly ) { - register int x, y; + int x, y; - x = lx * rp->xr; - y = ly * rp->yr; + x = (int)(lx*rp->xr + .5 - (lx < 0.0)); + y = (int)(ly*rp->yr + .5 - (ly < 0.0)); + if (rp->rt & XDECR) x = rp->xr-1 - x; if (rp->rt & YDECR) @@ -498,7 +497,7 @@ VIEW *vp ) { static char vwstr[128]; - register char *cp = vwstr; + char *cp = vwstr; *cp = '\0'; if (vp->type != stdview.type) { @@ -557,8 +556,8 @@ char *s { static char *altname[]={NULL,VIEWSTR,"rpict","rview","rvu","rpiece","pinterp",NULL}; extern char *progname; - register char *cp; - register char **an; + char *cp; + char **an; /* add program name to list */ if (altname[0] == NULL) { for (cp = progname; *cp; cp++)