1 /************************************************************************/ 2 /* Quad Tree basic definitions. */ 3 /************************************************************************/ 4 5 typedef struct qn_s 6 { 7 int qn_x; 8 int qn_y; 9 struct qn_s * qn_parent; 10 struct qn_s * qn_nw; 11 struct qn_s * qn_ne; 12 struct qn_s * qn_sw; 13 struct qn_s * qn_se; 14 15 int qn_nval; 16 void ** qn_vals; 17 } QuadNode; 18 19 typedef struct qt_s 20 { 21 QuadNode * qt_root; 22 int qt_x0; 23 int qt_x1; 24 int qt_y0; 25 int qt_y1; 26 } QuadTree; 27 28 extern QuadTree * qtmake( int x0, int x1, int y0, int y1 ); 29 extern int qtput( QuadTree * qt, int x, int y, void * data ); 30 extern int qtget( QuadTree * qt, int x, int y, 31 void ** pvals, int * pnval ); 32 extern int qtall( QuadTree * qt, int x0, int x1, int y0, int y1, 33 int (*fun)( void *, void * ), void * ); 34 extern void qtclose( QuadTree * qt ); 35