Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_trees.h File Reference

trees module headers More...

#include "nilorea/n_common.h"
#include "nilorea/n_str.h"
#include "nilorea/n_log.h"
#include "nilorea/n_list.h"
#include "nilorea/n_hash.h"
#include "nilorea/n_3d.h"
Include dependency graph for n_trees.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  COORD_VALUE
 Union to store the coordinate values. More...
struct  NODE_DATA
 structure of a TREE node data More...
union  NODE_DATA_TYPES
 union of the possibles data values of a TREE node More...
struct  OCTREE
 structure of an OCTREE More...
struct  OCTREE_NODE
 structure of an OCTREE node More...
struct  POINT2D
 Structure for a POINT2D in the 2D space. More...
struct  POINT3D
 Structure for a POINT3D in the 3D space. More...
struct  QUADTREE
 structure of a quad tree More...
struct  QUADTREE_NODE
 structure of a quad tree node More...
struct  TREE
 structure of a TREE More...
struct  TREE_NODE
 structure of a n-ary TREE node More...

Typedefs

typedef int(* compare_func) (COORD_VALUE a, COORD_VALUE b)
 function pointer types for comparison
typedef void(* print_func) (COORD_VALUE val)
 function pointer types for debug print

Enumerations

enum  COORD_TYPE { COORD_INT , COORD_FLOAT , COORD_DOUBLE }
 Enum for coordinate types. More...

Functions

QUADTREE_NODE * create_node (COORD_VALUE x, COORD_VALUE y, void *data_ptr)
 create a new quadtree node with position and data pointer
OCTREE * create_octree (int type)
 create a new octree for the given coordinate type
OCTREE_NODE * create_octree_node (POINT3D point, void *data_ptr)
 create a new octree node with position and data pointer
QUADTREE * create_quadtree (int coord_type)
 create a new quadtree for the given coordinate type
void free_octree (OCTREE *OCTREE)
 free the entire octree and its root
void free_octree_node (OCTREE_NODE *node)
 recursively free an octree node and its children
void free_quadtree (QUADTREE_NODE *root)
 recursively free all nodes of a quadtree
void insert (QUADTREE *qt, QUADTREE_NODE **root, COORD_VALUE x, COORD_VALUE y, void *data_ptr)
 insert a point with data into the quadtree
void insert_octree (OCTREE *OCTREE, POINT3D point, void *data_ptr)
 insert a point with data into the octree
TREE * new_tree ()
 create a new empty n-ary TREE
QUADTREE_NODE * search (QUADTREE *qt, QUADTREE_NODE *root, COORD_VALUE x, COORD_VALUE y)
 search for a point in the quadtree, return matching node or NULL
TREE_NODE * tree_create_node (NODE_DATA value, void(*destroy_func)(void *ptr))
 create a TREE_NODE with the given value and optional destructor
int tree_delete_node (TREE *tree, TREE_NODE *node)
 delete a TREE_NODE and all its children from the tree
void tree_destroy (TREE **tree)
 destroy a TREE and all its nodes, set pointer to NULL
int tree_insert_child (TREE_NODE *parent, TREE_NODE *child)
 insert a child node under the given parent node

Detailed Description

trees module headers

Author
Castagnier Mickael
Version
1.0
Date
07/08/2024

Definition in file n_trees.h.