1 Star 1 Fork 0

我的上铺叫路遥/kdtree

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
kdtree.h 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
我的上铺叫路遥 提交于 2017-03-03 21:08 . Spelling mistake
/*
* Copyright (C) 2017, Leo Ma <begeekmyfriend@gmail.com>
*/
#ifndef _KD_TREE_H
#define _KD_TREE_H
#define KDTREE_MAX_LEVEL 64
#define KDTREE_LEFT_INDEX 0
#define KDTREE_RIGHT_INDEX 1
typedef struct knn_list {
struct kdnode *node;
double distance;
struct knn_list *prev;
struct knn_list *next;
} knn_list_t;
typedef struct kdnode {
long coord_index;
double *coord;
struct kdnode *left;
struct kdnode *right;
int r;
} kdnode_t;
typedef struct kdtree {
struct kdnode *root;
size_t count;
size_t capacity;
double *coords;
double **coord_table;
long *coord_indexes;
unsigned char *coord_deleted;
unsigned char *coord_passed;
struct knn_list knn_list_head;
int dim;
int knn_num;
} kdtree_t;
struct kdtree *kdtree_init(int dim);
void kdtree_insert(struct kdtree *tree, double *coord);
void kdtree_rebuild(struct kdtree *tree);
void kdtree_knn_search(struct kdtree *tree, double *coord, int k);
void kdtree_destroy(struct kdtree *tree);
void kdtree_dump(struct kdtree *tree);
void kdtree_knn_dump(struct kdtree *tree);
#endif /* _KD_TREE_H */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/begeekmyfriend/kdtree.git
git@gitee.com:begeekmyfriend/kdtree.git
begeekmyfriend
kdtree
kdtree
master

搜索帮助