1 |
– |
/* Copyright (c) 1986 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* sphere.c - routines for creating octrees for spheres. |
6 |
|
* |
50 |
|
*/ |
51 |
|
|
52 |
|
|
53 |
< |
o_sphere(o, cu) /* determine if sphere intersects cube */ |
54 |
< |
OBJREC *o; |
55 |
< |
register CUBE *cu; |
53 |
> |
/* XXX o_sphere() is extern, but not declared in any header file */ |
54 |
> |
int |
55 |
> |
o_sphere( /* determine if sphere intersects cube */ |
56 |
> |
OBJREC *o, |
57 |
> |
register CUBE *cu |
58 |
> |
) |
59 |
|
{ |
60 |
|
FVECT v1; |
61 |
|
double d1, d2; |
62 |
< |
register double *fa; |
62 |
> |
register RREAL *fa; |
63 |
|
register int i; |
64 |
|
#define cent fa |
65 |
|
#define rad fa[3] |
66 |
|
/* get arguments */ |
67 |
+ |
if (o->oargs.nfargs != 4) |
68 |
+ |
objerror(o, USER, "bad # arguments"); |
69 |
|
fa = o->oargs.farg; |
70 |
< |
if (o->oargs.nfargs != 4 || rad <= FTINY) |
71 |
< |
objerror(o, USER, "bad arguments"); |
70 |
> |
if (rad < -FTINY) { |
71 |
> |
objerror(o, WARNING, "negative radius"); |
72 |
> |
o->otype = o->otype == OBJ_SPHERE ? |
73 |
> |
OBJ_BUBBLE : OBJ_SPHERE; |
74 |
> |
rad = -rad; |
75 |
> |
} else if (rad <= FTINY) |
76 |
> |
objerror(o, USER, "zero radius"); |
77 |
|
|
78 |
|
d1 = ROOT3/2.0 * cu->cusize; /* bounding radius for cube */ |
79 |
|
|