-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeightFunctor.hh
66 lines (55 loc) · 2.08 KB
/
WeightFunctor.hh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef WEIGHT_FUNCTOR_HH
#define WEIGHT_FUNCTOR_HH
#include "OpenMesh_Boost_Wrapper.hh"
#include "Common.hh"
#include <boost/graph/dijkstra_shortest_paths.hpp>
class WeightFunctor {
private:
TriMesh *m_mesh;
VertexHandle &m_currentV;
VertexHandle m_prevV;
const boost::iterator_property_map<std::vector<VertexHandle>::iterator, TriMesh_id_map>
*m_predecessor_pmap;
double m_maxEdgeLength;
double m_distanceCoefficient;
double m_textureCoefficient;
double m_curvatureCoefficient;
double m_skeletonCoefficient;
double m_pathCoefficient;
double distanceWeight(EdgeHandle eh) const;
double textureWeight(HalfedgeHandle heh) const;
// double curvatureWeight(VertexHandle v1, VertexHandle v2) const;
double curvatureWeight(EdgeHandle eh) const;
double skeletonWeight(EdgeHandle eh,
VertexHandle v1,
VertexHandle v2,
TriMesh::Point p1,
TriMesh::Point p2) const;
double smoothnessWeight(VertexHandle v1,
VertexHandle v2,
TriMesh::Point p1,
TriMesh::Point p2) const;
public:
WeightFunctor(TriMesh *mesh,
VertexHandle ¤tV,
const boost::iterator_property_map<std::vector<VertexHandle>::iterator, TriMesh_id_map>
*predecessor_pmap,
double distanceCoefficient,
double textureCoefficient,
double curvatureCoefficient,
double skeletonCoefficient,
double pathCoefficient);
double operator()(HalfedgeHandle heh) const;
double operator()(std::vector<HalfedgeHandle> segment);
};
class Dijkstra_visitor : public boost::default_dijkstra_visitor {
private:
VertexHandle ¤tV;
public:
Dijkstra_visitor (VertexHandle ¤tV) : currentV(currentV) {}
template <class Vertex, class Graph>
void examine_vertex(Vertex u, Graph &g) {
currentV = u;
}
};
#endif