Kd-Trees

Name

Kd-Trees -- an efficient way of doing point location queries.

Synopsis


#include <gts.h>


GNode*      gts_kdtree_new                  (GPtrArray *points,
                                             int (*compare) (const void *,const void *));
GSList*     gts_kdtree_range                (GNode *tree,
                                             GtsBBox *bbox,
                                             int (*compare) (const void *,const void *));
#define     gts_kdtree_destroy              (tree)

Description

Kd-Trees (in this case 3D-Trees) are a relatively efficient way of doing point location queries.

Details

gts_kdtree_new ()

GNode*      gts_kdtree_new                  (GPtrArray *points,
                                             int (*compare) (const void *,const void *));

Note that the order of the points in array points is modified by this function.

points :

an array of GtsPoint.

compare :

always NULL.

Returns :

a new 3D tree for points.


gts_kdtree_range ()

GSList*     gts_kdtree_range                (GNode *tree,
                                             GtsBBox *bbox,
                                             int (*compare) (const void *,const void *));

tree :

a 3D tree.

bbox :

a GtsBBox.

compare :

always NULL.

Returns :

a list of GtsPoint belonging to tree which are inside bbox.


gts_kdtree_destroy()

#define       gts_kdtree_destroy(tree)               g_node_destroy(tree)

tree :