资源简介
kdtree源码
详细内容看源码吧~~~
代码片段和文件信息
/*
This file is part of ‘‘kdtree‘‘ a library for working with kd-trees.
Copyright (C) 2007-2009 John Tsiombikas
Redistribution and use in source and binary forms with or without
modification are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ‘‘AS IS‘‘ AND ANY EXPRESS OR IMPLIED
WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL
EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE DATA OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN
CONTRACT STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
/* single nearest neighbor search written by Tamas Nepusz */
#include
#include
#include
#include
#include “kdtree.h“
#if defined(WIN32) || defined(__WIN32__)
#include
#endif
#ifdef USE_LIST_NODE_ALLOCATOR
#ifndef NO_PTHREADS
#include
#else
#ifndef I_WANT_THREAD_BUGS
#error “You are compiling with the fast list node allocator with pthreads disabled! This WILL break if used from multiple threads.“
#endif /* I want thread bugs */
#endif /* pthread support */
#endif /* use list node allocator */
struct kdhyperrect {
int dim;
double *min *max; /* minimum/maximum coords */
};
struct kdnode {
double *pos;
int dir;
void *data;
struct kdnode *left *right; /* negative/positive side */
};
struct res_node {
struct kdnode *item;
double dist_sq;
struct res_node *next;
};
struct kdtree {
int dim;
struct kdnode *root;
struct kdhyperrect *rect;
void (*destr)(void*);
};
struct kdres {
struct kdtree *tree;
struct res_node *rlist *riter;
int size;
};
#define SQ(x) ((x) * (x))
static void clear_rec(struct kdnode *node void (*destr)(void*));
static int insert_rec(struct kdnode **node const double *pos void *data int dir int dim);
static int rlist_insert(struct res_node *list struct kdnode *item double dist_sq);
static void clear_results(struct kdres *set);
static struct kdhyperrect* hyperrect_create(int dim const double *min const double *max);
static void hyperrect_free(struc
- 上一篇:银行业务模拟代码
- 下一篇:获取WINDOWS是否登录及登录用户名支持服务模式
相关资源
- C语言程序300集(pdf,清晰)
- linux局域网聊天软件server+client 源码
- C++ 高效 屏幕找图 函数源码 终极版
- 获取网络时间校正本地系统时间,C
- windows下 c++实现ping地址源码两种
- MFC程序开发之聊天室客户端+服务器源
- mfc 贪吃蛇游戏 MFC实现贪吃蛇小游戏
- 开放源码的计算机图形学几何算法包
- c++实现四则运算器源码 支持括号
- c语言实现字典顺序排序
- 一个双色球彩票随机选号器6+1C++源码
- 数据结构约瑟夫环实习报告及源码
- tcp socket实现单进程单线程 高并发服务
- 摄影测量空间后方交会程序合集,含
- 实现最近点对问题源的代码(C语言)
- 板材切割c源码
- 人工智能旅行商问题实验报告及C++源
- 远程桌面源码
- funcode 打飞虫c语言源码
- 《C语言程序开发范例宝典》光盘源码
- 51单片机直流电机控制C语言代码.rar
- 哈夫曼编码与解码(C语言实现)
- QT C++ 算法 广搜BFS 最小步数解二阶魔
- VC++压缩解压zip文件支持密码
- C图像读写源代码.zip
- C语言课程设计大作业-学生管理系统含
- 山大C++实验
- 基于vc6.0串口调试助手源码
- c++音频原始数据PCM采样率转换-源码和
- 读取串口数据并画出曲线图的VC++程序
评论
共有 条评论