--- ray/src/ot/o_cone.c 2005/06/14 17:10:06 2.5 +++ ray/src/ot/o_cone.c 2016/04/21 00:40:35 2.7 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: o_cone.c,v 2.5 2005/06/14 17:10:06 greg Exp $"; +static const char RCSid[] = "$Id: o_cone.c,v 2.7 2016/04/21 00:40:35 greg Exp $"; #endif /* * o_cone.c - routines for intersecting cubes with cones. @@ -11,7 +11,12 @@ static const char RCSid[] = "$Id: o_cone.c,v 2.5 2005/ #include "octree.h" #include "object.h" #include "cone.h" +#include "plocate.h" +#ifndef STRICT +#define STRICT 1 +#endif + #define ROOT3 1.732050808 /* @@ -36,21 +41,23 @@ static int findcseg(FVECT ep0, FVECT ep1, CONE *co, FV extern int o_cone( /* determine if cone intersects cube */ OBJREC *o, - register CUBE *cu + CUBE *cu ) { CONE *co; FVECT ep0, ep1; -#ifdef STRICT +#if STRICT FVECT cumin, cumax; CUBE cukid; - register int j; + int j; #endif double r; FVECT p; - register int i; + int i; /* get cone arguments */ co = getcone(o, 0); + if (co == NULL) /* check for degenerate case */ + return(O_MISS); /* get cube center */ r = cu->cusize * 0.5; for (i = 0; i < 3; i++) @@ -61,7 +68,7 @@ o_cone( /* determine if cone intersects cube */ /* check min. distance to cone */ if (dist2lseg(p, ep0, ep1) > (r+FTINY)*(r+FTINY)) return(O_MISS); -#ifdef STRICT +#if STRICT /* get cube boundaries */ for (i = 0; i < 3; i++) cumax[i] = (cumin[i] = cu->cuorg[i]) + cu->cusize; @@ -96,13 +103,13 @@ static int findcseg( /* find line segment from cone closest to p */ FVECT ep0, FVECT ep1, - register CONE *co, + CONE *co, FVECT p ) { double d; FVECT v; - register int i; + int i; /* find direction from axis to point */ VSUB(v, p, CO_P0(co)); d = DOT(v, co->ad);