8#ifndef __NILOREA_TREES__
9#define __NILOREA_TREES__
Structure of a generic LIST container.
Structure of a generic list node.
A box including a string and his lenght.
print_func print
pointer to print function
compare_func compare
pointer to comparison function
TREE_NODE * root
pointer to first node
pthread_rwlock_t rwlock
mutex for thread safety (optional)
struct QUADTREE_NODE * nw
North-West child.
int coord_type
type of coordinate used in the quad tree
size_t nb_nodes
number of nodes in the tree
COORD_VALUE z
z coordinate
void * data_ptr
Pointer to additional data, can be NULL.
OCTREE_NODE * root
tree list first node
COORD_VALUE y
Y coordinate.
QUADTREE_NODE * root
tree list first node
union NODE_DATA_TYPES value
node value
COORD_VALUE x
x coordinate
NODE_DATA data
structure holding values for node
struct QUADTREE_NODE * sw
South-West child.
COORD_VALUE x
x coordinate
COORD_VALUE y
y coordinate
void * data_ptr
Pointer to data, can be NULL.
struct QUADTREE_NODE * se
South-East child.
POINT3D point
Point represented by this node.
struct QUADTREE_NODE * ne
North-East child.
void(* destroy_func)(void *ptr)
value destructor if of type ptr and specified, else a simple free will be used
COORD_VALUE y
y coordinate
COORD_VALUE x
X coordinate.
struct OCTREE_NODE * children[8]
Child nodes.
LIST_NODE * parent_list_node
pointer to parent container of the TREE_NODE, LIST_NODE
struct TREE_NODE * parent
pointer to parent
size_t height
height of the tree
LIST * children
ordered list of children
int coord_type
Coordinate type for the entire tree.
int(* compare_func)(COORD_VALUE a, COORD_VALUE b)
function pointer types for comparison
void free_octree_node(OCTREE_NODE *node)
recursive function to free an OCTREE node and its children
void insert_octree(OCTREE *OCTREE, POINT3D point, void *data_ptr)
Insert a point into the OCTREE.
int tree_insert_child(TREE_NODE *parent, TREE_NODE *child)
insert a child node into the parent node
void free_quadtree(QUADTREE_NODE *root)
Function to free the quad tree.
TREE * new_tree()
create a new TREE
TREE_NODE * tree_create_node(NODE_DATA value, void(*destroy_func)(void *ptr))
create a TREE node
void(* print_func)(COORD_VALUE val)
function pointer types for debug print
QUADTREE_NODE * search(QUADTREE *qt, QUADTREE_NODE *root, COORD_VALUE x, COORD_VALUE y)
Function to search for a point in the quad tree.
COORD_TYPE
Enum for coordinate types.
void free_octree(OCTREE *OCTREE)
free the OCTREE
void tree_destroy(TREE **tree)
destroy a TREE
OCTREE_NODE * create_octree_node(POINT3D point, void *data_ptr)
create and OCTREE node
OCTREE * create_octree(int type)
Create a new OCTREE with a specified coordinate type.
int tree_delete_node(TREE *tree, TREE_NODE *node)
delete a TREE node
void insert(QUADTREE *qt, QUADTREE_NODE **root, COORD_VALUE x, COORD_VALUE y, void *data_ptr)
Function to insert a point into the quad tree.
QUADTREE * create_quadtree(int coord_type)
Function to create a new quad tree.
QUADTREE_NODE * create_node(COORD_VALUE x, COORD_VALUE y, void *data_ptr)
function to create a new quad tree node
structure of a TREE node data
structure of an OCTREE node
Structure for a POINT2D in the 2D space.
Structure for a POINT3D in the 3D space.
structure of a quad tree node
structure of a n-ary TREE node
Union to store the coordinate values.
union of the possibles data values of a TREE node
Simple 3D movement simulation.
Common headers and low-level hugly functions & define.
Hash functions and table.
List structures and definitions.
N_STR and string function declaration.