pf_kdtree.h
Go to the documentation of this file.
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey & Kasper Stoy
4  * gerkey@usc.edu kaspers@robotics.usc.edu
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 /**************************************************************************
22  * Desc: KD tree functions
23  * Author: Andrew Howard
24  * Date: 18 Dec 2002
25  * CVS: $Id: pf_kdtree.h 6532 2008-06-11 02:45:56Z gbiggs $
26  *************************************************************************/
27 
28 #ifndef PF_KDTREE_H
29 #define PF_KDTREE_H
30 
31 #ifdef INCLUDE_RTKGUI
32 #include "rtk.h"
33 #endif
34 
35 
36 // Info for a node in the tree
37 typedef struct pf_kdtree_node
38 {
39  // Depth in the tree
40  int leaf, depth;
41 
42  // Pivot dimension and value
43  int pivot_dim;
44  double pivot_value;
45 
46  // The key for this node
47  int key[3];
48 
49  // The value for this node
50  double value;
51 
52  // The cluster label (leaf nodes)
53  int cluster;
54 
55  // Child nodes
57 
59 
60 
61 // A kd tree
62 typedef struct
63 {
64  // Cell size
65  double size[3];
66 
67  // The root node of the tree
69 
70  // The number of nodes in the tree
71  int node_count, node_max_count;
73 
74  // The number of leaf nodes in the tree
76 
77 } pf_kdtree_t;
78 
79 
80 // Create a tree
81 extern pf_kdtree_t *pf_kdtree_alloc(int max_size);
82 
83 // Destroy a tree
84 extern void pf_kdtree_free(pf_kdtree_t *self);
85 
86 // Clear all entries from the tree
87 extern void pf_kdtree_clear(pf_kdtree_t *self);
88 
89 // Insert a pose into the tree
90 extern void pf_kdtree_insert(pf_kdtree_t *self, pf_vector_t pose, double value);
91 
92 // Cluster the leaves in the tree
93 extern void pf_kdtree_cluster(pf_kdtree_t *self);
94 
95 // Determine the probability estimate for the given pose
96 extern double pf_kdtree_get_prob(pf_kdtree_t *self, pf_vector_t pose);
97 
98 // Determine the cluster label for the given pose
99 extern int pf_kdtree_get_cluster(pf_kdtree_t *self, pf_vector_t pose);
100 
101 
102 #ifdef INCLUDE_RTKGUI
103 
104 // Draw the tree
105 extern void pf_kdtree_draw(pf_kdtree_t *self, rtk_fig_t *fig);
106 
107 #endif
108 
109 #endif
pf_kdtree_node_t * root
Definition: pf_kdtree.h:68
double pf_kdtree_get_prob(pf_kdtree_t *self, pf_vector_t pose)
Definition: pf_kdtree.c:150
void pf_kdtree_clear(pf_kdtree_t *self)
Definition: pf_kdtree.c:100
void pf_kdtree_insert(pf_kdtree_t *self, pf_vector_t pose, double value)
Definition: pf_kdtree.c:112
struct pf_kdtree_node * children[2]
Definition: pf_kdtree.h:56
struct pf_kdtree_node pf_kdtree_node_t
int node_max_count
Definition: pf_kdtree.h:71
void pf_kdtree_free(pf_kdtree_t *self)
Definition: pf_kdtree.c:90
int leaf_count
Definition: pf_kdtree.h:75
int key[3]
Definition: pf_kdtree.h:47
pf_kdtree_node_t * nodes
Definition: pf_kdtree.h:72
pf_kdtree_t * pf_kdtree_alloc(int max_size)
Definition: pf_kdtree.c:66
int pf_kdtree_get_cluster(pf_kdtree_t *self, pf_vector_t pose)
Definition: pf_kdtree.c:168
double pivot_value
Definition: pf_kdtree.h:44
void pf_kdtree_cluster(pf_kdtree_t *self)
Definition: pf_kdtree.c:358
double value
Definition: pf_kdtree.h:50


nav2d_localizer
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:33