| 11 |
|
#include "octree.h" |
| 12 |
|
#include "object.h" |
| 13 |
|
#include "cone.h" |
| 14 |
+ |
#include "plocate.h" |
| 15 |
|
|
| 16 |
+ |
#ifndef STRICT |
| 17 |
+ |
#define STRICT 1 |
| 18 |
+ |
#endif |
| 19 |
+ |
|
| 20 |
|
#define ROOT3 1.732050808 |
| 21 |
|
|
| 22 |
|
/* |
| 41 |
|
extern int |
| 42 |
|
o_cone( /* determine if cone intersects cube */ |
| 43 |
|
OBJREC *o, |
| 44 |
< |
register CUBE *cu |
| 44 |
> |
CUBE *cu |
| 45 |
|
) |
| 46 |
|
{ |
| 47 |
|
CONE *co; |
| 48 |
|
FVECT ep0, ep1; |
| 49 |
< |
#ifdef STRICT |
| 49 |
> |
#if STRICT |
| 50 |
|
FVECT cumin, cumax; |
| 51 |
|
CUBE cukid; |
| 52 |
< |
register int j; |
| 52 |
> |
int j; |
| 53 |
|
#endif |
| 54 |
|
double r; |
| 55 |
|
FVECT p; |
| 56 |
< |
register int i; |
| 56 |
> |
int i; |
| 57 |
|
/* get cone arguments */ |
| 58 |
|
co = getcone(o, 0); |
| 59 |
+ |
if (co == NULL) /* check for degenerate case */ |
| 60 |
+ |
return(O_MISS); |
| 61 |
|
/* get cube center */ |
| 62 |
|
r = cu->cusize * 0.5; |
| 63 |
|
for (i = 0; i < 3; i++) |
| 68 |
|
/* check min. distance to cone */ |
| 69 |
|
if (dist2lseg(p, ep0, ep1) > (r+FTINY)*(r+FTINY)) |
| 70 |
|
return(O_MISS); |
| 71 |
< |
#ifdef STRICT |
| 71 |
> |
#if STRICT |
| 72 |
|
/* get cube boundaries */ |
| 73 |
|
for (i = 0; i < 3; i++) |
| 74 |
|
cumax[i] = (cumin[i] = cu->cuorg[i]) + cu->cusize; |
| 103 |
|
findcseg( /* find line segment from cone closest to p */ |
| 104 |
|
FVECT ep0, |
| 105 |
|
FVECT ep1, |
| 106 |
< |
register CONE *co, |
| 106 |
> |
CONE *co, |
| 107 |
|
FVECT p |
| 108 |
|
) |
| 109 |
|
{ |
| 110 |
|
double d; |
| 111 |
|
FVECT v; |
| 112 |
< |
register int i; |
| 112 |
> |
int i; |
| 113 |
|
/* find direction from axis to point */ |
| 114 |
|
VSUB(v, p, CO_P0(co)); |
| 115 |
|
d = DOT(v, co->ad); |