main.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <grass/raster.h>
  2. #define SHORT short
  3. #define TRUE 1
  4. #define FALSE 0
  5. #define MELEMENT struct Melement
  6. MELEMENT {
  7. short x, y; /* grid coordinates */
  8. int value;
  9. MELEMENT *next, *prior; /* next and prior element in row list */
  10. };
  11. #define NEIGHBOR struct neighbor
  12. NEIGHBOR {
  13. double distance;
  14. MELEMENT *Mptr, /* pointer to data in linked lists of input */
  15. **searchptr; /* row search pointer that identified this
  16. neighbor */
  17. NEIGHBOR *next;
  18. };
  19. /* structure for search pointers which access a row list of MELEMENTs */
  20. /* if latitude-longitude, ealive and walive prevent search collisions on a
  21. circular, doubly-linked list; else, list is linear (NULL terminated) and
  22. pointers to MELEMENT are set NULL to indicate end of search in a direction */
  23. #define EW struct ew
  24. EW {
  25. MELEMENT *east, /* next eastward search in this row */
  26. *west, /* next westward search in this row */
  27. *start; /* starting point of east and west search in this row */
  28. short ealive, walive; /* used only for latitude-longitude,
  29. TRUE if search is active in this direction */
  30. EW *next;
  31. };
  32. /* dist.c */
  33. int G_begin_geodesic_distance_l(short, double, double);
  34. double LL_set_geodesic_distance_lat(double);
  35. double set_sdlmr(double);
  36. int LL_set_geodesic_distance(double *, int, int);
  37. double LL_geodesic_distance(double);
  38. int free_dist_params(void);
  39. /* ll.c */
  40. int extend_west(EW *);
  41. int extend_east(EW *);
  42. double distance_LL(SHORT, SHORT, MELEMENT *);
  43. int LL_lookup_tables(SHORT, SHORT);
  44. /* main.c */
  45. int lookup_and_function_ptrs(SHORT, SHORT);
  46. int interpolate(MELEMENT[], SHORT, SHORT, SHORT, int, int, int);
  47. int make_neighbors_list(EW *, EW *, EW *, SHORT, SHORT, NEIGHBOR *, int);
  48. int search(EW **, NEIGHBOR *, SHORT, SHORT, int, SHORT *, EW *, SHORT);
  49. int exhaust(EW **, NEIGHBOR *, SHORT, SHORT);
  50. EW *next_row(EW *, EW *, SHORT *, SHORT);
  51. double triangulate(MELEMENT *, SHORT, SHORT);
  52. int add_neighbor(MELEMENT **, NEIGHBOR *, double, int);
  53. int replace_neighbor(MELEMENT **, NEIGHBOR *, double);
  54. int sort_neighbors(NEIGHBOR *, double);
  55. int free_row_lists(MELEMENT *, SHORT);
  56. MELEMENT *row_lists(SHORT, SHORT, SHORT *, int *, int, CELL *);
  57. int lookup_tables(SHORT, SHORT);