-
Notifications
You must be signed in to change notification settings - Fork 3
/
Polygon.h
83 lines (55 loc) · 1.52 KB
/
Polygon.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef POLYGON_H
#define POLYGON_H
#include <math.h>
#include <iostream>
#include <GL/glut.H>
#include <cstdlib>
#include <vector>
#include <memory>
using namespace std;
class Vertex {
public:
int index;
std::vector<float> pos;
std::vector<float> origPos;
std::vector<float> nor;
std::vector<float> lap;
std::vector<std::shared_ptr<Vertex>> nei, origNei;
std::vector<int> tri;
float curv;
int neiN, lapN, triN, nei2N, origNeiN;
bool edge, analysed, border; // if vertex has a value higher then threshold
int group;
Vertex(int i);
float getPos(int n);
void computeLaplacian();
void curvatureComputation(float aveE);
void back2original();
void clearVector();
void checkThreshold(float threshold);
bool checkCurvDiff(std::shared_ptr<Vertex> n, float threshold);
void smooth(float dt);
void addNeighbor(std::shared_ptr<Vertex> n);
void addFace(int t);
void checkBorder();
int surroundingGroup();
void plot();
};
class Polygon {
public:
std::vector<std::shared_ptr<Vertex>> origVer;
std::vector<std::shared_ptr<Vertex>> ver;
std::vector<float> nor;
bool border, old;
int index;
int group;
int neiN, nei2N; // number of added nei, total number of nei, total number of nei that shares the same 2 vertex
std::vector<std::shared_ptr<Polygon>> nei, nei2;
Polygon(int i);
void prepVerticesLaplacian();
void back2original();
void clearVector();
void addNeighbor(std::shared_ptr<Polygon> n);
void checkBorder();
};
#endif