-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid-aoi.h
69 lines (56 loc) · 1.55 KB
/
grid-aoi.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
#ifndef _GRID_AOI_H_
#define _GRID_AOI_H_
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <assert.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct int_valuevec {
int *values;
size_t n;
size_t size;
}*int_valuevecptr;
typedef struct hash_node
{
void *value;
int key;
int next;
}*hash_node_ptr;
typedef struct hash_map {
struct hash_node *nodes;
struct hash_node *lastfree;
size_t size;
size_t n;
}*hash_map_ptr;
typedef struct aoi_context {
float width;
float height;
int grid_width;
int view_range;
int x_grid_count;
int y_grid_count;
struct hash_map obj_map;
struct hash_map grid_map;
}*aoi_contextptr;
void valuevec_init(int_valuevecptr valuevec);
void valuevec_push(int_valuevecptr valuevec, int value);
int valuevec_get(int_valuevecptr valuevec, size_t index);
void valuevec_clear(int_valuevecptr valuevec);
size_t valuevec_count(int_valuevecptr valuevec);
size_t valuevec_size(int_valuevecptr valuevec);
void valuevec_free(int_valuevecptr valuevec);
aoi_contextptr aoi_new(float width, float height, int grid_width, int view_range);
void aoi_delete(aoi_contextptr context);
int aoi_enter(aoi_contextptr context, int id, float x, float y, short layer,
short view_layer, int_valuevecptr enter_self, int_valuevecptr enter_other);
int aoi_leave(aoi_contextptr context, int id, int_valuevecptr leave_other);
int aoi_move(aoi_contextptr context, int id, float x, float y, int_valuevecptr enter,
int_valuevecptr leave);
int aoi_viewlist(aoi_contextptr context, int id, int_valuevecptr viewed);
#ifdef __cplusplus
}
#endif
#endif