forked from icemiliang/lscm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMesh.h
105 lines (80 loc) · 2.48 KB
/
Mesh.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef _MESHLIB_MESH_H_
#define _MESHLIB_MESH_H_
#define MAX_LINE 2048
#include <assert.h>
#include <math.h>
#include "Edge.h"
#include "Face.h"
#include "HalfEdge.h"
#include "Vertex.h"
#include "Point.h"
#include <list>
#include <map>
namespace MeshLib {
class Vertex;
class HalfEdge;
class Edge;
class Face;
class Mesh {
public:
typedef Vertex * pVertex;
typedef HalfEdge * pHalfEdge;
typedef Edge * pEdge;
typedef Face * pFace;
typedef Mesh * pMesh;
Mesh(){};
~Mesh();
int copy(Mesh &mesh);
int read_obj(const char *input);
int write_obj(const char *output);
int numVertices();
int numEdges();
int numFaces();
bool is_boundary(Vertex *v);
bool is_boundary(Edge *e);
bool is_boundary(HalfEdge *he);
Vertex *id_vertex(int id);
int vertex_id(Vertex* v);
Face *id_face(int id);
int face_id(Face *f);
Edge *vertex_edge(Vertex *v1, Vertex *v2);
HalfEdge *vertex_halfedge(Vertex *v1, Vertex *v2);
HalfEdge *corner(Vertex *v, Face *f);
Face *halfedge_face(HalfEdge *he);
Vertex *halfedge_vertex(HalfEdge *he);
Vertex *edge_vertex_1(Edge *e);
Vertex *edge_vertex_2(Edge *e);
Face *edge_face_1(Edge *e);
Face *edge_face_2(Edge *e);
//Euler operations
HalfEdge *vertexMostClwOutHalfEdge(Vertex *v);
HalfEdge *vertexNextCcwOutHalfEdge(HalfEdge *he);
HalfEdge *vertexMostCcwOutHalfEdge(Vertex *v);
HalfEdge *vertexNextClwOutHalfEdge(HalfEdge *he);
HalfEdge *vertexMostClwInHalfEdge(Vertex *v);
HalfEdge *vertexNextCcwInHalfEdge(HalfEdge *he);
HalfEdge *vertexMostCcwInHalfEdge(Vertex *v);
HalfEdge *vertexNextClwInHalfEdge(HalfEdge *he);
HalfEdge *faceMostClwHalfEdge(Face *f);
HalfEdge *faceMostCcwHalfEdge(Face *f);
HalfEdge *faceNextCcwHalfEdge(HalfEdge *he);
HalfEdge *faceNextClwHalfEdge(HalfEdge *he);
double edge_length(Edge *e);
std::list<Edge*> &edges() { return m_edges; };
std::list<Face*> &faces() { return m_faces; };
std::list<Vertex*> &vertices() { return m_vertices; };
protected:
std::list<Edge*> m_edges;
std::list<Face*> m_faces;
std::list<Vertex*> m_vertices;
std::map<int, Vertex*> m_map_vertex;
std::map<int, Face*> m_map_face;
std::map<EdgeKey, Edge*> m_map_edge;
// std::map<int, Edge> m_map_edge;
protected:
Vertex *create_vertex(int id);
Edge *create_edge(Vertex *v1, Vertex *v2);
Face *create_face(Vertex *v[], int id);
};
}
#endif