--- ray/src/hd/sm_qtree.h 1998/08/25 11:03:27 3.3 +++ ray/src/hd/sm_qtree.h 1999/01/05 16:52:39 3.10 @@ -19,7 +19,14 @@ * * < -1: it is an index to a set of objects */ +#include "object.h" +typedef struct _FUNC { + int (*func)(); + int *argptr; +}FUNC; +#define F_FUNC(f) (f.func) +#define F_ARGS(f) (f.argptr) #define QUADTREE int #define EMPTY (-1) @@ -34,6 +41,7 @@ #define QT_BLOCK(qt) ((qt)>>10) /* quadtree block index */ #define QT_BLOCK_INDEX(qt) (((qt)&0x3ff)<<2) /* quadtree index in block */ + #ifndef QT_MAX_BLK #ifdef BIGMEM #define QT_MAX_BLK 16383 /* maximum quadtree block */ @@ -50,14 +58,13 @@ /* QUADTREE NODE FLAGS */ -#define QT_OFFSET(qt) ((qt)>>5) -#define QT_F_BIT(qt) ((qt)&0x1f) -#define QT_F_OP(f,qt,op) ((f)[QT_OFFSET(qt)] op (0x1< a?4:0) | (b1[0] > a?2:0) | (b2[0] > a?1:0)), \ + s1 = ((b0[1] > b?4:0) | (b1[1] > b?2:0) | (b2[1] > b?1:0)), \ + s2 = ((b0[2] > c?4:0) | (b1[2] > c?2:0) | (b2[2] > c?1:0))) + +#define SIDES_LESS(b0,b1,b2,s0,s1,s2,a,b,c) \ + (s0 = ((b0[0] < a?4:0) | (b1[0] < a?2:0) | (b2[0] < a?1:0)), \ + s1 = ((b0[1] < b?4:0) | (b1[1] < b?2:0) | (b2[1] < b?1:0)), \ + s2 = ((b0[2] < c?4:0) | (b1[2] < c?2:0) | (b2[2] < c?1:0))) + +/* +QUADTREE qtRoot_point_locate(qt,q0,q1,q2,peq,pt,r0,r1,r2) + QUADTREE qt; + FVECT q0,q1,q2; + FPEQ peq; + FVECT pt; + FVECT r0,r1,r2; + + Return the quadtree node containing pt. It is assumed that pt is in + the root node qt with ws vertices q0,q1,q2 and plane equation peq. + If r0 != NULL will return coordinates of node in (r0,r1,r2). +*/ + +extern QUADTREE qtRoot_point_locate(); +extern QUADTREE qtRoot_add_tri(); +extern QUADTREE qtRoot_remove_tri(); +extern QUADTREE qtAdd_tri(); +extern QUADTREE qtRoot_visit_tri_edges(); +extern QUADTREE qtRoot_trace_ray();