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.
76 lines
1.4 KiB
76 lines
1.4 KiB
9 months ago
|
#pragma once
|
||
|
|
||
|
#ifdef _WIN32
|
||
9 months ago
|
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL 项目模板会将 <PROJECTNAME>_EXPORTS 添加到定义预处理器宏。
|
||
|
#define BVH_API __declspec(dllexport) // _WIN32
|
||
9 months ago
|
#else
|
||
|
#define BVH_API __declspec(dllimport)
|
||
|
#endif
|
||
|
#else
|
||
|
#define BVH_API
|
||
9 months ago
|
#endif
|
||
9 months ago
|
|
||
9 months ago
|
#include "ReadXML.h"
|
||
|
#include <cmath>
|
||
|
#include <vector>
|
||
|
#include <queue>
|
||
|
#include <map>
|
||
|
#include <iostream>
|
||
|
#include <fstream>
|
||
|
#include <sstream>
|
||
|
using namespace std;
|
||
9 months ago
|
|
||
9 months ago
|
extern bool BVH_API PointInTri(Point3 &P, Point3 &P0, Point3 &P1, Point3 &P2);
|
||
9 months ago
|
|
||
9 months ago
|
struct BVH_API Triangle
|
||
|
{
|
||
9 months ago
|
P p[3];
|
||
|
|
||
9 months ago
|
void getbox(P &_min, P &_max);
|
||
9 months ago
|
void print();
|
||
|
};
|
||
|
|
||
9 months ago
|
extern bool BVH_API cmpt0(const Triangle &a, const Triangle &b);
|
||
|
extern bool BVH_API cmpt1(const Triangle &a, const Triangle &b);
|
||
|
extern bool BVH_API cmpt2(const Triangle &a, const Triangle &b);
|
||
9 months ago
|
|
||
9 months ago
|
struct BVH_API O_AABB
|
||
|
{
|
||
|
P _min;
|
||
|
P _max;
|
||
|
int l, r;
|
||
9 months ago
|
|
||
|
O_AABB();
|
||
9 months ago
|
O_AABB(const P &min, const P &max);
|
||
9 months ago
|
|
||
9 months ago
|
bool insig(double x, double a, double b);
|
||
9 months ago
|
|
||
9 months ago
|
bool inbox(const P &p);
|
||
9 months ago
|
|
||
9 months ago
|
bool hit(P &p1, P &p2);
|
||
9 months ago
|
};
|
||
|
|
||
9 months ago
|
struct BVH_API BVH
|
||
|
{
|
||
|
int trinum, tot, root;
|
||
9 months ago
|
Triangle tri[MaxSTL];
|
||
|
O_AABB ab[400010];
|
||
|
|
||
|
BVH();
|
||
|
|
||
|
void update(int x);
|
||
|
|
||
9 months ago
|
void build(int &x, int l, int r, int k);
|
||
9 months ago
|
|
||
9 months ago
|
bool TriSegIntersection(Point3 &P0, Point3 &P1, Point3 &P2, Point3 &A, Point3 &B);
|
||
9 months ago
|
|
||
9 months ago
|
bool TriSegIntersection(Triangle &t, Point3 &A, Point3 &B);
|
||
9 months ago
|
|
||
9 months ago
|
bool query(int x, int l, int r, P &A, P &B);
|
||
9 months ago
|
|
||
9 months ago
|
bool iscollect(P &A, P &B);
|
||
9 months ago
|
|
||
|
void read_stl(string filename);
|
||
|
};
|
||
9 months ago
|
|
||
|
extern BVH_API BVH bvh;
|