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 |
|
* o_cone.c - routines for intersecting cubes with cones. |
6 |
|
* |
56 |
|
if (findcseg(ep0, ep1, co, p) > 0.0) { |
57 |
|
/* check min. distance to cone */ |
58 |
|
if (dist2lseg(p, ep0, ep1) > (r+FTINY)*(r+FTINY)) |
59 |
< |
return(0); |
59 |
> |
return(O_MISS); |
60 |
|
#ifdef STRICT |
61 |
|
/* get cube boundaries */ |
62 |
|
for (i = 0; i < 3; i++) |
63 |
|
cumax[i] = (cumin[i] = cu->cuorg[i]) + cu->cusize; |
64 |
|
/* closest segment intersects? */ |
65 |
|
if (clip(ep0, ep1, cumin, cumax)) |
66 |
< |
return(1); |
66 |
> |
return(O_HIT); |
67 |
|
} |
68 |
|
/* check sub-cubes */ |
69 |
|
cukid.cusize = cu->cusize * 0.5; |
70 |
|
if (cukid.cusize < mincusize) |
71 |
< |
return(1); /* cube too small */ |
71 |
> |
return(O_HIT); /* cube too small */ |
72 |
|
cukid.cutree = EMPTY; |
73 |
|
|
74 |
|
for (j = 0; j < 8; j++) { |
78 |
|
cukid.cuorg[i] += cukid.cusize; |
79 |
|
} |
80 |
|
if (o_cone(o, &cukid)) |
81 |
< |
return(1); /* sub-cube intersects */ |
81 |
> |
return(O_HIT); /* sub-cube intersects */ |
82 |
|
} |
83 |
< |
return(0); /* no intersection */ |
83 |
> |
return(O_MISS); /* no intersection */ |
84 |
|
#else |
85 |
|
} |
86 |
< |
return(1); /* assume intersection */ |
86 |
> |
return(O_HIT); /* assume intersection */ |
87 |
|
#endif |
88 |
|
} |
89 |
|
|