-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquadTree.h
73 lines (51 loc) · 2 KB
/
quadTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef QUADTREE_H
#define QUADTREE_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "zergmap.h"
#include "graph.h"
typedef struct point point;
typedef struct boundingBox box;
typedef struct quadTree qt;
// Creates and returns a point object.
point *create_point(double lat, double lon);
// Creates and returns a point object for Zerg points.
point *create_zerg_point(struct zerg_header *z_hdr);
// Prints the point object to stdout.
void point_print(point * p);
// Creates and returns a new bounding box object.
box *create_box(point * center, double halfDimension);
// Returns true or false depending on if the point is located in the bounding
// box.
bool box_contains_point(box * boundry, point * point);
// Returns true or false if one bounding box intersects the second bounding
// box.
bool box_intersects(box * self, box * check);
// Creates and returns a new quadTree object.
qt *create_quadTree(box * boundry);
// Frees memory allocated for point objects.
void point_destroy(point * p);
// Frees memory allocated for boxes.
void box_destroy(box * b);
// Frees memory allocated for quadTree.
void qt_destroy(qt * qt);
// Returns a size_t count of how many points are in the quadTree.
size_t number_of_points(qt * qt);
// This function is used with the quadTree to divide into regions.
qt *subdivide(qt * root);
// Returns true or false if a point is inserted into the quadTree.
bool qt_insert(qt * root, point * point);
// Returns an array of point objects that are in the specified search box.
point **quadTree_search(qt * root, box * range);
// Prints results after performing a search.
void print_search_results(point ** result);
// Frees memory allocated for results array.
void result_destroy(point ** result);
// Prints points within a quadTree.
void print_quadTree_points(qt * qt, graph * g);
// Adds edges to graph.
void point_add_edges(graph * g, qt * qt, point ** result);
// Returns difference for two given altitude values.
uint32_t return_alt(uint32_t alt, uint32_t alt2);
#endif