-
Notifications
You must be signed in to change notification settings - Fork 1
/
edge.cpp
26 lines (23 loc) · 617 Bytes
/
edge.cpp
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
#include "vertex.h"
#include "edge.h"
// EDGE CONSTRUCTOR
Edge::Edge(Vertex *vs, Vertex *ve, Face *f) {
start_vertex = vs;
end_vertex = ve;
face = f;
next = NULL;
opposite = NULL;
}
// EDGE DESTRUCTOR
Edge::~Edge() {
// disconnect from the opposite edge
if (opposite != NULL)
opposite->opposite = NULL;
// NOTE: the "prev" edge (which has a "next" pointer pointing to
// this edge) will also be deleted as part of the triangle removal,
// so we don't need to disconnect that
}
double Edge::Length() const {
Vec3f diff = start_vertex->get() - end_vertex->get();
return diff.Length();
}