--- ray/src/ot/sphere.c 1989/10/14 11:19:36 1.2 +++ ray/src/ot/sphere.c 2003/02/22 02:07:26 2.2 @@ -1,9 +1,6 @@ -/* Copyright (c) 1986 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: sphere.c,v 2.2 2003/02/22 02:07:26 greg Exp $"; #endif - /* * sphere.c - routines for creating octrees for spheres. * @@ -59,14 +56,21 @@ register CUBE *cu; { FVECT v1; double d1, d2; - register double *fa; + register FLOAT *fa; register int i; #define cent fa #define rad fa[3] /* get arguments */ + if (o->oargs.nfargs != 4) + objerror(o, USER, "bad # arguments"); fa = o->oargs.farg; - if (o->oargs.nfargs != 4 || rad <= FTINY) - objerror(o, USER, "bad arguments"); + if (rad < -FTINY) { + objerror(o, WARNING, "negative radius"); + o->otype = o->otype == OBJ_SPHERE ? + OBJ_BUBBLE : OBJ_SPHERE; + rad = -rad; + } else if (rad <= FTINY) + objerror(o, USER, "zero radius"); d1 = ROOT3/2.0 * cu->cusize; /* bounding radius for cube */