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.
112 lines
2.3 KiB
112 lines
2.3 KiB
10 months ago
|
#pragma once
|
||
|
|
||
|
#ifdef _WIN32
|
||
|
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL ��Ŀģ���Ὣ <PROJECTNAME>_EXPORTS ���ӵ�����Ԥ�������ꡣ
|
||
|
#define ASTAR_API __declspec(dllexport) // _WIN32
|
||
|
#else
|
||
|
#define ASTAR_API __declspec(dllimport)
|
||
|
#endif
|
||
|
#else
|
||
|
#define ASTAR_API
|
||
|
#endif
|
||
|
|
||
|
#include "BranchTree.h"
|
||
|
|
||
|
#include<cmath>
|
||
|
#include<vector>
|
||
|
#include<queue>
|
||
|
#include<map>
|
||
|
#include<iostream>
|
||
|
#include<fstream>
|
||
|
#include<sstream>
|
||
|
#include <cassert>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
extern ASTAR_API BranchTree branchTree;
|
||
|
|
||
|
struct ASTAR_API DSU{
|
||
|
int f[N];
|
||
|
void init(int cnt);
|
||
|
int getrt(int x);
|
||
|
void merge(int x, int y);
|
||
|
};
|
||
|
|
||
|
|
||
|
struct ASTAR_API Node{
|
||
|
int xs,turncnt;
|
||
|
double dis;
|
||
|
bool operator <(Node B)const;
|
||
|
Node();
|
||
|
Node(int xs1,int turnc,double dis1);
|
||
|
};
|
||
|
|
||
|
//��������·�������ݽṹ��ÿ�����͵����������䵽һ��
|
||
|
struct ASTAR_API Astar{
|
||
|
ClipSet * pclipSet; //ָ������
|
||
|
BranchTree *pbranchTree; //ָ����֧��
|
||
|
P points[MAXPointNum]; //������Ϣ�����������㣬��֧���Ͷ˵�
|
||
|
P start,goal,start_dir,goal_dir; //�����յ��Լ�����
|
||
|
int S,T; //�������յ��ı���
|
||
|
map<int, vector<int> >edge;
|
||
|
//�洢ÿ���㸽������ײ�������㣬�����ظ�����kdtree��bvh
|
||
|
map<P,pair<int,int> > nearClip; //��Ϊ�˵㴦���ֲܷ棬���Ա��Ƕ˵����ӵ�����������
|
||
|
|
||
|
int searchNum; //�������������ڵ���
|
||
|
int pre[MAXPointNum],vis[MAXPointNum]; //pre�洢һ��������һ���㣬vis�洢һ�����Ƿ��ʹ�
|
||
|
int st[MAXPointNum],block[MAXPointNum]; //st����ʱջ��block���ǵĵ㲻�ܱ�ͨ��
|
||
|
int pnum; //����������
|
||
|
int tnum; //�������
|
||
|
Path path; //·������
|
||
|
double bend_r,l; //�����뾶���ܳ���
|
||
|
Node dis[MAXPointNum]; //�洢������Ϣ
|
||
|
priority_queue<Node>pq; //���ȶ���
|
||
|
double preBranchPointPos[MAXPointNum]; //��ǰһ������1���ͣ�ͬ����������֧�㣬�洢������λ��
|
||
|
|
||
|
Astar();
|
||
|
|
||
|
void addBranchTree(BranchTree *pbranchTree);
|
||
|
|
||
|
//��ʼ��
|
||
|
void init();
|
||
|
|
||
|
//����һ��������
|
||
|
void add_clip(P& p, P& d);
|
||
|
|
||
|
void add_clip(Clip& cp);
|
||
|
|
||
|
//����һ����֧��
|
||
|
void add_branchPoint(BranchPoint& bp);
|
||
|
|
||
|
/*
|
||
|
inline double cost(P &p1,P &p2){
|
||
|
if(bvh.iscollect(p1,p2))return 1e9;
|
||
|
//return distan(p1,p2);
|
||
|
return angelAndLength(p1,p2);
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
Path search_pair(P& start, P& goal, P& start_dir, P& goal_dir, double dia);
|
||
|
|
||
|
|
||
|
Path search_pair(P& start, P& goal, double dia);
|
||
|
|
||
|
Path search_pair(Bund& bd);
|
||
|
|
||
|
void searchForPreProcess();
|
||
|
|
||
|
void search();
|
||
|
|
||
|
|
||
|
|
||
|
};
|
||
|
|
||
|
extern ASTAR_API Astar astar;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|