diff options
Diffstat (limited to 'src/ix2.h')
-rw-r--r-- | src/ix2.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ix2.h b/src/ix2.h new file mode 100644 index 0000000..345a310 --- /dev/null +++ b/src/ix2.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2018 Vito Caputo - <vcaputo@pengaru.com> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _IX2_H +#define _IX2_H + +typedef struct ix2_object_t ix2_object_t; +typedef struct ix2_t ix2_t; +typedef struct aabb_t aabb_t; +typedef struct v2f_t v2f_t; + +typedef enum ix2_search_status_t { + IX2_SEARCH_STOP, + IX2_SEARCH_IGNORE, + IX2_SEARCH_CONTINUE +} ix2_search_status_t; + +typedef ix2_search_status_t (*ix2_search_cb)(void *cb_context, ix2_object_t *ix2_object, aabb_t *ix2_object_aabb, void *object); + +ix2_t * ix2_new(aabb_t *aabb, unsigned max_per_node, unsigned max_depth); +void ix2_free(ix2_t *ix2); +ix2_object_t * ix2_insert_object(ix2_t *ix2, aabb_t *aabb, void *object); +void ix2_remove_object(ix2_t *ix2, ix2_object_t *object); +ix2_object_t * ix2_move_object(ix2_t *ix2, ix2_object_t *object, aabb_t *aabb); +unsigned ix2_search_by_point(ix2_t *ix2, v2f_t *point, ix2_search_cb cb, void *arg); +unsigned ix2_search_by_aabb(ix2_t *ix2, aabb_t *aabb, ix2_search_cb cb, void *arg); +unsigned ix2_search_by_ray(ix2_t *ix2, v2f_t *origin, v2f_t *direction, ix2_search_cb cb, void *arg); + +#endif |