Commit 0727fa49 by Philipp Adolf

Add get_neighbor

parent c5b2bea6
#include <cassert>
#include <QDebugStateSaver> #include <QDebugStateSaver>
#include "triangle.h" #include "triangle.h"
...@@ -187,6 +188,19 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian ...@@ -187,6 +188,19 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian
} }
} }
Triangle::Neighbor Triangle::Neighbors::get_neighbor(Triangle::Edge::Name name) {
switch (name) {
case Triangle::Edge::Name::uv:
return this->uv;
case Triangle::Edge::Name::vw:
return this->vw;
case Triangle::Edge::Name::wu:
return this->wu;
default:
assert(false);
}
}
void insert_neighbor(QMap<Triangle, Triangle::Neighbors> &neighbors, const Triangle &triangle_a, const Triangle::Edge &edge_a, Triangle *triangle_b, const Triangle::Edge &edge_b) { void insert_neighbor(QMap<Triangle, Triangle::Neighbors> &neighbors, const Triangle &triangle_a, const Triangle::Edge &edge_a, Triangle *triangle_b, const Triangle::Edge &edge_b) {
if (!neighbors.contains(triangle_a)) { if (!neighbors.contains(triangle_a)) {
neighbors.insert(triangle_a, Triangle::Neighbors()); neighbors.insert(triangle_a, Triangle::Neighbors());
......
...@@ -30,6 +30,8 @@ class Triangle { ...@@ -30,6 +30,8 @@ class Triangle {
Neighbor uv; Neighbor uv;
Neighbor vw; Neighbor vw;
Neighbor wu; Neighbor wu;
Triangle::Neighbor get_neighbor(Triangle::Edge::Name name);
}; };
Triangle(); Triangle();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment