You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.3 KiB

#pragma once
#ifdef _WIN32
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL ��Ŀģ���Ὣ <PROJECTNAME>_EXPORTS ���ӵ�����Ԥ�������ꡣ
#define KD_TREE_API __declspec(dllexport) // _WIN32
#else
#define KD_TREE_API __declspec(dllimport)
#endif
#else
#define KD_TREE_API
#endif
#include "BVH.h"
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<iostream>
#include<fstream>
#include<sstream>
using namespace std;
struct KD_TREE_API point{
double x[3];
int id;
point();
};
extern bool KD_TREE_API cmp0(const point& a, const point& b);
extern bool KD_TREE_API cmp1(const point& a, const point& b);
extern bool KD_TREE_API cmp2(const point& a, const point& b);
struct KD_TREE_API node{
double dis;
int id;
bool operator < (node b)const ;
node();
node(int id1,double dis1);
};
struct KD_TREE_API tree{
point p;
double mx[3],mn[3];
int ls,rs,id;
tree();
};
struct KD_TREE_API KDtree{
int n,tot,root;
double X,Y,Z;
priority_queue<node> q;
vector<int> vec;
point p[MAXPointNum];
tree t[MAXPointNum];
KDtree();
double dis(tree& x);
double mndis(tree& x);
void update(int x);
void query(int x);
void queryd(int x,double d);
void add(P& s);
void build(int& x, int l, int r, int k);
void build();
vector<int> search_by_k(P& s, int k);
//���ؾ���s��d���ڵ����е��ı���
vector<int> search_by_dis(P& s, double d);
};