qtree.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifndef TREE_H
  24. #define TREE_H
  25. #define VOID_T char
  26. /*!
  27. * Function table for a tree
  28. *
  29. * From object oriented point of view, this structure represents
  30. * a class or a virtual table of functions/methods for a class.
  31. */
  32. struct multfunc
  33. {
  34. int (*compare) ();
  35. struct quaddata **(*divide_data) ();
  36. int (*add_data) ();
  37. int (*intersect) ();
  38. int (*division_check) ();
  39. int (*get_points) ();
  40. };
  41. struct tree_info
  42. {
  43. struct multfunc *functions;
  44. double dmin;
  45. int kmax;
  46. struct multtree *root;
  47. };
  48. struct multtree
  49. {
  50. struct quaddata *data;
  51. struct multtree **leafs;
  52. struct multtree *parent;
  53. int multant;
  54. };
  55. struct multfunc *MT_functions_new(int (*)(struct triple *, struct quaddata *),
  56. struct quaddata **(*)(struct quaddata *,
  57. int, double),
  58. int (*)(struct triple *, struct quaddata *,
  59. double), int (*)(struct quaddata *,
  60. struct quaddata *),
  61. int (*)(struct quaddata *, int),
  62. int (*)(struct quaddata *,
  63. struct quaddata *, int));
  64. struct tree_info *MT_tree_info_new(struct multtree *, struct multfunc *,
  65. double, int);
  66. struct multtree *MT_tree_new(struct quaddata *, struct multtree **,
  67. struct multtree *, int);
  68. int MT_insert(struct triple *, struct tree_info *, struct multtree *, int);
  69. int MT_divide(struct tree_info *, struct multtree *, int);
  70. int MT_region_data(struct tree_info *, struct multtree *, struct quaddata *,
  71. int, int);
  72. #endif