--- ray/src/rt/o_face.c 1989/02/02 10:41:32 1.1 +++ ray/src/rt/o_face.c 2003/02/25 02:47:23 2.3 @@ -1,15 +1,12 @@ -/* Copyright (c) 1986 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: o_face.c,v 2.3 2003/02/25 02:47:23 greg Exp $"; #endif - /* * o_face.c - compute ray intersection with faces. - * - * 8/29/85 */ +#include "copyright.h" + #include "ray.h" #include "face.h" @@ -41,7 +38,7 @@ register RAY *r; if (rdot <= FTINY && rdot >= -FTINY) /* ray parallels plane */ t = FHUGE; else - t = (DOT(r->rorg, f->norm) - f->const) / rdot; + t = (DOT(r->rorg, f->norm) - f->offset) / rdot; if (t <= FTINY || t >= r->rot) /* not good enough */ return(0); @@ -49,13 +46,15 @@ register RAY *r; for (i = 0; i < 3; i++) pisect[i] = r->rorg[i] + r->rdir[i]*t; - if (inface(pisect, f)) { /* ray intersects face? */ + if (!inface(pisect, f)) /* ray intersects face? */ + return(0); - r->ro = o; - r->rot = t; - VCOPY(r->rop, pisect); - VCOPY(r->ron, f->norm); - r->rod = rdot; - } + r->ro = o; + r->rot = t; + VCOPY(r->rop, pisect); + VCOPY(r->ron, f->norm); + r->rod = rdot; + r->rox = NULL; + return(1); /* hit */ }