Commit 0727fa49 by Philipp Adolf

Add get_neighbor

parent c5b2bea6
#include <cassert>
#include <QDebugStateSaver>
#include "triangle.h"
......@@ -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) {
if (!neighbors.contains(triangle_a)) {
neighbors.insert(triangle_a, Triangle::Neighbors());
......
......@@ -30,6 +30,8 @@ class Triangle {
Neighbor uv;
Neighbor vw;
Neighbor wu;
Triangle::Neighbor get_neighbor(Triangle::Edge::Name name);
};
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