-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathUnsignedDistance.h
45 lines (35 loc) · 1 KB
/
UnsignedDistance.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include "PointTriangleDistance.h"
#include "DataStructs.h"
namespace MeshSdf
{
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
using Point_ = bg::model::point<double, 3, bg::cs::cartesian>;
using Box_ = bg::model::box<Point_>;
using Value_ = std::pair<Box_, int>;
using RTree = bgi::rtree<Value_, bgi::rstar<8>>;
using Ring_ = bg::model::ring<Point_, true, false>;
class UnsignedDistance
{
RTree rtree;
std::vector<Vec3> verts;
std::vector<Tri> tris;
public:
UnsignedDistance(std::vector<Vec3> verts, std::vector<Tri> tris);
struct UDistInfo
{
double udist;
int triNearest;
Vec3 triPtNearest;
NearestTriEntity triEntityNearest;
};
UDistInfo operator()(double x, double y, double z, int) const;
double operator()(double x, double y, double z) const;
};
}