-
Notifications
You must be signed in to change notification settings - Fork 0
/
DCEL.h
83 lines (70 loc) · 1.38 KB
/
DCEL.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
/**
DCEL.h
doubly linked edge list header file
main data structure for storing mesh infomation
also where subdivision occurs
@author
Lanqin Yuan
Kiranpreet Bajwa
Aleks Djuric
*/
#ifndef DCEL_H
#define DCEL_H
#include <GLFW/glfw3.h>
#include <vector>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <map>
struct Vertex;
struct Face;
struct HalfEdge
{
Vertex* vertex; // vertex at the end of the half-edge
HalfEdge* pair; // oppositely oriented adjacent half-edge
Face* face; // face the half-edge borders
HalfEdge* next; // next half-edge around the face
};
struct Vertex
{
// position
float x;
float y;
float z;
// normals
float nx;
float ny;
float nz;
// one of the half-edges emantating from the vertex
HalfEdge* halfEdge;
};
struct Face
{
// one of the half-edges bordering the face
HalfEdge* halfEdge;
};
// Forward declaration
class HalfEdge;
class Vertex;
class Face;
// Implementation of doublely connected edge list (DCEL) aka half-edge data structure
class DCEL
{
public:
// ## Variables ##
std::vector<Face*> faceList;
std::vector<Vertex*> vertexList;
std::vector<HalfEdge*> halfEdgeList;
// ## Constructor ##
DCEL();
// ## Functions ##
void readOBJ(std::string fileName);
void drawMesh();
private:
// ## Variables ##
// ## Functions ##
};
// This is the end of the header guard
#endif