--- ray/src/rt/rv3.c 2003/02/25 02:47:23 2.11 +++ ray/src/rt/rv3.c 2005/01/18 00:33:16 2.14 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rv3.c,v 2.11 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: rv3.c,v 2.14 2005/01/18 00:33:16 greg Exp $"; #endif /* * rv3.c - miscellaneous routines for rview. @@ -9,10 +9,10 @@ static const char RCSid[] = "$Id: rv3.c,v 2.11 2003/02 #include "copyright.h" -#include "ray.h" +#include +#include "ray.h" #include "rpaint.h" - #include "random.h" #ifndef WFLUSH @@ -125,6 +125,8 @@ double *mp; } else if (direc) for (i = 0; i < 3; i++) vec[i] -= ourview.vp[i]; + if (normalize(vec) == 0.0) + return(-1); return(0); } @@ -371,9 +373,9 @@ register VIEW *vp; if ((err = setview(vp)) != NULL) { sprintf(errmsg, "view not set - %s", err); error(COMMAND, errmsg); - } else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { - copystruct(&oldview, &ourview); - copystruct(&ourview, vp); + } else if (memcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { + oldview = ourview; + ourview = *vp; newimage(); } } @@ -386,11 +388,9 @@ FVECT vc; { double d; FVECT v1; - VIEW nv; + VIEW nv = ourview; register int i; - VCOPY(nv.vup, ourview.vup); - nv.hoff = ourview.hoff; nv.voff = ourview.voff; spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); if (elev != 0.0) { fcross(v1, ourview.vup, nv.vdir); @@ -403,11 +403,7 @@ FVECT vc; d = 0.0; /* don't move closer */ for (i = 0; i < 3; i++) d += (vc[i] - ourview.vp[i])*ourview.vdir[i]; - nv.vfore = ourview.vfore; - nv.vaft = ourview.vaft; } else { - nv.horiz = ourview.horiz; - nv.vert = ourview.vert; d = sqrt(dist2(ourview.vp, vc)) / mag; if ((nv.vfore = ourview.vfore) > FTINY) { nv.vfore += d - d*mag;