tesseract
3.04.00
|
#include "kdtree.h"
#include "const.h"
#include "emalloc.h"
#include "freelist.h"
#include <stdio.h>
#include <math.h>
Go to the source code of this file.
Classes | |
class | MinK< Key, Value > |
struct | MinK< Key, Value >::Element |
class | KDTreeSearch |
Macros | |
#define | Magnitude(X) ((X) < 0 ? -(X) : (X)) |
#define | NodeFound(N, K, D) (( (N)->Key == (K) ) && ( (N)->Data == (D) )) |
#define | MINSEARCH -MAX_FLOAT32 |
#define | MAXSEARCH MAX_FLOAT32 |
Functions | |
KDTREE * | MakeKDTree (inT16 KeySize, const PARAM_DESC KeyDesc[]) |
void | KDStore (KDTREE *Tree, FLOAT32 *Key, void *Data) |
void | KDDelete (KDTREE *Tree, FLOAT32 Key[], void *Data) |
void | KDNearestNeighborSearch (KDTREE *Tree, FLOAT32 Query[], int QuerySize, FLOAT32 MaxDistance, int *NumberOfResults, void **NBuffer, FLOAT32 DBuffer[]) |
void | KDWalk (KDTREE *Tree, void_proc action, void *context) |
void | FreeKDTree (KDTREE *Tree) |
KDNODE * | MakeKDNode (KDTREE *tree, FLOAT32 Key[], void *Data, int Index) |
void | FreeKDNode (KDNODE *Node) |
FLOAT32 | DistanceSquared (int k, PARAM_DESC *dim, FLOAT32 p1[], FLOAT32 p2[]) |
FLOAT32 | ComputeDistance (int k, PARAM_DESC *dim, FLOAT32 p1[], FLOAT32 p2[]) |
void | Walk (KDTREE *tree, void_proc action, void *context, KDNODE *sub_tree, inT32 level) |
void | InsertNodes (KDTREE *tree, KDNODE *nodes) |
void | FreeSubTree (KDNODE *sub_tree) |
#define Magnitude | ( | X | ) | ((X) < 0 ? -(X) : (X)) |
Definition at line 31 of file kdtree.cpp.
#define MAXSEARCH MAX_FLOAT32 |
Definition at line 38 of file kdtree.cpp.
#define MINSEARCH -MAX_FLOAT32 |
Definition at line 37 of file kdtree.cpp.
#define NodeFound | ( | N, | |
K, | |||
D | |||
) | (( (N)->Key == (K) ) && ( (N)->Data == (D) )) |
Definition at line 32 of file kdtree.cpp.
FLOAT32 ComputeDistance | ( | int | k, |
PARAM_DESC * | dim, | ||
FLOAT32 | p1[], | ||
FLOAT32 | p2[] | ||
) |
Definition at line 486 of file kdtree.cpp.
FLOAT32 DistanceSquared | ( | int | k, |
PARAM_DESC * | dim, | ||
FLOAT32 | p1[], | ||
FLOAT32 | p2[] | ||
) |
Definition at line 465 of file kdtree.cpp.
void FreeKDNode | ( | KDNODE * | Node | ) |
Definition at line 407 of file kdtree.cpp.
void FreeKDTree | ( | KDTREE * | Tree | ) |
Definition at line 346 of file kdtree.cpp.
void FreeSubTree | ( | KDNODE * | sub_tree | ) |
Definition at line 568 of file kdtree.cpp.
Definition at line 558 of file kdtree.cpp.
This routine deletes a node from Tree. The node to be deleted is specified by the Key for the node and the Data contents of the node. These two pointers must be identical to the pointers that were used for the node when it was originally stored in the tree. A node will be deleted from the tree only if its key and data pointers are identical to Key and Data respectively. The tree is re-formed by removing the affected subtree and inserting all elements but the root.
Tree | K-D tree to delete node from |
Key | key of node to be deleted |
Data | data contents of node to be deleted |
Definition at line 269 of file kdtree.cpp.
void KDNearestNeighborSearch | ( | KDTREE * | Tree, |
FLOAT32 | Query[], | ||
int | QuerySize, | ||
FLOAT32 | MaxDistance, | ||
int * | NumberOfResults, | ||
void ** | NBuffer, | ||
FLOAT32 | DBuffer[] | ||
) |
Definition at line 307 of file kdtree.cpp.
This routine stores Data in the K-D tree specified by Tree using Key as an access key.
Tree | K-D tree in which data is to be stored |
Key | ptr to key by which data can be retrieved |
Data | ptr to data to be stored in the tree |
Definition at line 209 of file kdtree.cpp.
Definition at line 339 of file kdtree.cpp.
Definition at line 371 of file kdtree.cpp.
KDTREE* MakeKDTree | ( | inT16 | KeySize, |
const PARAM_DESC | KeyDesc[] | ||
) |
Return a new KDTREE based on the specified parameters. Parameters: KeySize # of dimensions in the K-D tree KeyDesc array of params to describe key dimensions
Definition at line 184 of file kdtree.cpp.
Definition at line 547 of file kdtree.cpp.