--- ray/src/rt/o_face.c 1989/02/21 14:56:20 1.2 +++ ray/src/rt/o_face.c 2004/03/30 16:13:01 2.5 @@ -1,23 +1,22 @@ -/* 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.5 2004/03/30 16:13:01 schorsch Exp $"; #endif - /* * o_face.c - compute ray intersection with faces. - * - * 8/29/85 */ -#include "ray.h" +#include "copyright.h" +#include "ray.h" #include "face.h" +#include "rtotypes.h" -o_face(o, r) /* compute intersection with polygonal face */ -OBJREC *o; -register RAY *r; +extern int +o_face( /* compute intersection with polygonal face */ + OBJREC *o, + register RAY *r +) { double rdot; /* direction . normal */ double t; /* distance to intersection */ @@ -49,13 +48,17 @@ 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->pert[0] = r->pert[1] = r->pert[2] = 0.0; + r->uv[0] = r->uv[1] = 0.0; + r->rox = NULL; + return(1); /* hit */ }