-
Notifications
You must be signed in to change notification settings - Fork 1
/
vertex.h
60 lines (44 loc) · 1.51 KB
/
vertex.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
#ifndef _VERTEX_H
#define _VERTEX_H
#include <cassert>
#include "vectors.h"
// ==========================================================
class Vertex {
public:
// ========================
// CONSTRUCTOR & DESTRUCTOR
Vertex(int i, const Vec3f &pos) : position(pos) { index = i; s = 0; t = 0; }
// =========
// ACCESSORS
int getIndex() const { return index; }
double x() const { return position.x(); }
double y() const { return position.y(); }
double z() const { return position.z(); }
const Vec3f& get() const { return position; }
double get_s() const { return s; }
double get_t() const { return t; }
// =========
// MODIFIERS
void setTextureCoordinates(double _s, double _t) { s = _s; t = _t; }
private:
// don't use these constructors
Vertex() { assert(0); }
Vertex& operator=(const Vertex&) { assert(0); exit(0); }
Vertex(const Vertex&) { assert(0); }
// ==============
// REPRESENTATION
Vec3f position;
// texture coordinates
// NOTE: arguably these should be stored at the faces of the mesh
// rather than the vertices
double s,t;
// this is the index from the original .obj file.
// technically not part of the half-edge data structure
int index;
// NOTE: the vertices don't know anything about adjacency. In some
// versions of this data structure they have a pointer to one of
// their incoming edges. However, this data is complicated to
// maintain during mesh manipulation.
};
// ==========================================================
#endif