-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgumptionaire.h
76 lines (63 loc) · 1.14 KB
/
gumptionaire.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
74
75
76
#include "point_search.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EXPORT_DLL
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif
struct Points {
int n;
int8_t* id;
int32_t* rank;
float* x;
float* y;
};
struct Region {
int n;
Point* ranksort;
Points* rankpoints;
Rect* rect;
Rect* crect;
Region* left;
Region* right;
Region* lrmid;
Region* bottom;
Region* top;
Region* btmid;
float subw, subh;
};
struct GumpSearchContext {
int32_t N;
// Binary search
Point* xsort;
Point* ysort;
Points* xpoints;
Points* ypoints;
// Region search
Point* ranksort;
Region* root;
Rect* trim;
// Grid search
Point* gridsort;
Point*** grid;
Rect** grect;
Rect** drect;
int** dlen;
Rect* bounds;
double area;
double dx, dy;
// Current search
Point** blocks;
int* blocki;
int* blockn;
float w;
float h;
};
SearchContext* __stdcall DLL_API create(const Point* points_begin, const Point* points_end);
int32_t __stdcall DLL_API search(SearchContext* sc, const Rect rect, const int32_t count, Point* out_points);
SearchContext* __stdcall DLL_API destroy(SearchContext* sc);
#ifdef __cplusplus
}
#endif