![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
tree functions More...
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_str.h"
#include "nilorea/n_trees.h"
Go to the source code of this file.
Functions | |
int | compare_double (COORD_VALUE a, COORD_VALUE b) |
double comparison functions | |
int | compare_float (COORD_VALUE a, COORD_VALUE b) |
float comparison function | |
int | compare_int (COORD_VALUE a, COORD_VALUE b) |
int comparison function | |
QUADTREE_NODE * | create_node (COORD_VALUE x, COORD_VALUE y, void *data_ptr) |
function to create a new quad tree node | |
OCTREE * | create_octree (int type) |
Create a new OCTREE with a specified coordinate type. | |
OCTREE_NODE * | create_octree_node (POINT3D point, void *data_ptr) |
create and OCTREE node | |
QUADTREE * | create_quadtree (int coord_type) |
Function to create a new quad tree. | |
int | determine_octant (POINT3D point, POINT3D center, int type) |
function to determine the octant for the given point relative to the node | |
void | free_octree (OCTREE *octree) |
free the OCTREE | |
void | free_octree_node (OCTREE_NODE *node) |
recursive function to free an OCTREE node and its children | |
void | free_quadtree (QUADTREE_NODE *root) |
Function to free the quad tree. | |
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. | |
void | insert_octree (OCTREE *octree, POINT3D point, void *data_ptr) |
Insert a point into the OCTREE. | |
void | insert_octree_node (OCTREE_NODE *node, POINT3D point, void *data_ptr, int type) |
recursive function to insert a point into the OCTREE | |
TREE * | new_tree () |
create a new TREE | |
void | print_double (COORD_VALUE val) |
| |
void | print_float (COORD_VALUE val) |
| |
void | print_int (COORD_VALUE val) |
| |
QUADTREE_NODE * | search (QUADTREE *qt, QUADTREE_NODE *root, COORD_VALUE x, COORD_VALUE y) |
Function to search for a point in the quad tree. | |
TREE_NODE * | tree_create_node (NODE_DATA value, void(*destroy_func)(void *ptr)) |
create a TREE node | |
int | tree_delete_node (TREE *tree, TREE_NODE *node) |
delete a TREE node | |
void | tree_destroy (TREE **tree) |
destroy a TREE | |
int | tree_insert_child (TREE_NODE *parent, TREE_NODE *child) |
insert a child node into the parent node | |
int compare_double | ( | COORD_VALUE | a, |
COORD_VALUE | b | ||
) |
double comparison functions
a | COORD_VALUE double element to compare |
b | COORD_VALUE double element to compare |
Definition at line 173 of file n_trees.c.
Referenced by create_quadtree().
int compare_float | ( | COORD_VALUE | a, |
COORD_VALUE | b | ||
) |
float comparison function
a | COORD_VALUE float element to compare |
b | COORD_VALUE float element to compare |
Definition at line 163 of file n_trees.c.
Referenced by create_quadtree().
int compare_int | ( | COORD_VALUE | a, |
COORD_VALUE | b | ||
) |
int comparison function
a | COORD_VALUE int element to compare |
b | COORD_VALUE int element to compare |
Definition at line 153 of file n_trees.c.
Referenced by create_quadtree().
function to determine the octant for the given point relative to the node
point | POINT3D coordinates of the target point |
center | POINT3D coordinates of the center point |
type | the type of coordinate used by the OCTREE (COORD_INT,COORD_FLOAT,COORD_DOUBLE) |
Definition at line 354 of file n_trees.c.
References POINT3D::x, POINT3D::y, and POINT3D::z.
Referenced by insert_octree_node().
void insert_octree_node | ( | OCTREE_NODE * | node, |
POINT3D | point, | ||
void * | data_ptr, | ||
int | type | ||
) |
recursive function to insert a point into the OCTREE
node | the target OCTREE_NODE *node |
point | the POINT3D point to insert |
data_ptr | eventual private data forthe point, can be NULL |
type | the type of coordinate used by the OCTREE (COORD_INT,COORD_FLOAT,COORD_DOUBLE) |
Definition at line 379 of file n_trees.c.
References OCTREE_NODE::children, create_octree_node(), determine_octant(), insert_octree_node(), and OCTREE_NODE::point.
Referenced by insert_octree(), and insert_octree_node().
void print_double | ( | COORD_VALUE | val | ) |
print double function
val | the COORD_VALUE from which to read the double to print |
Definition at line 198 of file n_trees.c.
Referenced by create_quadtree().
void print_float | ( | COORD_VALUE | val | ) |
print float function
val | the COORD_VALUE from which to read the float to print |
Definition at line 190 of file n_trees.c.
Referenced by create_quadtree().
void print_int | ( | COORD_VALUE | val | ) |
print int function
val | the COORD_VALUE from which to read the int to print |
Definition at line 181 of file n_trees.c.
Referenced by create_quadtree().