-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmesh.hpp
More file actions
52 lines (46 loc) · 1.1 KB
/
Copy pathmesh.hpp
File metadata and controls
52 lines (46 loc) · 1.1 KB
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
#ifndef POLYLOWER_MESH_H
#define POLYLOWER_MESH_H
#include <vector>
#include <list>
#include <queue>
#include <array>
#include "vec.hpp"
#include "util.hpp"
using namespace std;
struct edge {
int u, v;
double cost;
vec target;
int time_stamp;
edge(int u, int v, double cost, const vec &target, int time_stamp)
: u(u), v(v), cost(cost), target(target), time_stamp(time_stamp) {}
bool operator<(const edge &rhs) const {
return cost > rhs.cost;
}
};
class Mesh {
private:
vector<vec> V;
vector<array<int, 3>> F;
vector<Mat4> Q;
vector<int> validV;
vector<int> validF;
vector<int> timestamps;
vector<list<int>> facelist;
priority_queue<edge> edges;
void initQ();
double calcCost(const vec& target, const Mat4 &q);
bool faceflip(const vec& target, int u, int v) const ;
void selectEdges();
void addedge(int u, int v, int timestamp);
bool is_edge_valid(const edge &e) const;
void refresh();
public:
Mesh() {}
~Mesh() {}
void simplify(double rate);
void aggregation(int epoch);
void load(const string &filename);
void dump(const string &filename);
};
#endif