1 /*!
2  * \file qtree.c
3  *
4  * \author
5  * H. Mitasova, I. Kosinovsky, D. Gerdes, Fall 1993,
6  * University of Illinois and
7  * US Army Construction Engineering Research Lab
8  *
9  * \author H. Mitasova (University of Illinois),
10  * \author I. Kosinovsky, (USA-CERL)
11  * \author D.Gerdes (USA-CERL)
12  *
13  * \author updated/checked by Mitasova Nov. 96 (no changes necessary)
14  *
15  * \copyright
16  * (C) 1993-1996 by Helena Mitasova and the GRASS Development Team
17  *
18  * \copyright
19  * This program is free software under the
20  * GNU General Public License (>=v2).
21  * Read the file COPYING that comes with GRASS for details.
22  */
23 
24 
25 #ifndef TREE_H
26 
27 #define TREE_H
28 
29 #define VOID_T char
30 
31 
32 /*!
33  * Function table for a tree
34  *
35  * From object oriented point of view, this structure represents
36  * a class or a virtual table of functions/methods for a class.
37  */
38 struct multfunc
39 {
40     int (*compare) ();
41     struct quaddata **(*divide_data) ();
42     int (*add_data) ();
43     int (*intersect) ();
44     int (*division_check) ();
45     int (*get_points) ();
46 };
47 
48 struct tree_info
49 {
50     struct multfunc *functions;
51     double dmin;
52     int kmax;
53     struct multtree *root;
54 };
55 
56 struct multtree
57 {
58     struct quaddata *data;
59     struct multtree **leafs;
60     struct multtree *parent;
61     int multant;
62 };
63 
64 struct multfunc *MT_functions_new(int (*)(struct triple *, struct quaddata *),
65 				  struct quaddata **(*)(struct quaddata *,
66 							int, double),
67 				  int (*)(struct triple *, struct quaddata *,
68 					  double), int (*)(struct quaddata *,
69 							   struct quaddata *),
70 				  int (*)(struct quaddata *, int),
71 				  int (*)(struct quaddata *,
72 					  struct quaddata *, int));
73 struct tree_info *MT_tree_info_new(struct multtree *, struct multfunc *,
74 				   double, int);
75 struct multtree *MT_tree_new(struct quaddata *, struct multtree **,
76 			     struct multtree *, int);
77 int MT_insert(struct triple *, struct tree_info *, struct multtree *, int);
78 int MT_divide(struct tree_info *, struct multtree *, int);
79 int MT_region_data(struct tree_info *, struct multtree *, struct quaddata *,
80 		   int, int);
81 
82 #endif
83