代码拉取完成,页面将自动刷新
/*
* 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 */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。