Commit 4422b074 by Philipp Adolf

Add vertexNeighbors

parent 5a700c96
......@@ -353,6 +353,25 @@ void Subdivision::buildNeighborsMap(QVector<Vertex> &vb, QVector<Triangle> &tria
qCDebug(log_timing) << "buildNeighborsMap_gpu done:" << formatTimeMeasurement(timer.elapsed());
}
/**
* Returns triangles that use a vertex except for the starting triangle.
*
* @param triangle the starting triangle. Will not be returned.
* @param current_neighbor a neighbor of the starting triangle.
* @param neighbors neighbors of triangles
* @return all neighbors of the first vertex of the neighbor except for the starting triangle.
*/
QVector<Triangle> Subdivision::vertexNeighbors(Triangle &triangle, Triangle::Neighbor current_neighbor, QMap<Triangle, Triangle::Neighbors> neighbors) {
QVector<Triangle> ns;
do {
assert(current_neighbor.triangle != NULL);
ns.push_back(*current_neighbor.triangle);
current_neighbor = neighbors.value(*current_neighbor.triangle).get_neighbor(rotate_edge_name(current_neighbor.edge.name));
} while (*current_neighbor.triangle != triangle);
assert(current_neighbor.triangle != NULL);
return ns;
}
void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QMap<Triangle, Triangle::Neighbors> &neighbors, unsigned int offset) {
//compute edge table
//Format: first two entries: edge vertices. last two entries: distant vertices.
......
......@@ -59,6 +59,7 @@ private:
QOpenGLShaderProgram *initComputeShaderProgram(QString &source);
Tables precomputeTables(Input input);
void buildNeighborsMap(QVector<Vertex> &vb, QVector<Triangle> &triangles, QMap<Triangle, Triangle::Neighbors> &neighbors);
QVector<Triangle> vertexNeighbors(Triangle &triangle, Triangle::Neighbor current_neighbor, QMap<Triangle, Triangle::Neighbors> neighbors);
void precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QMap<Triangle, Triangle::Neighbors> &neighbors, unsigned int offset);
void precomputeVertexTable(Subdivision::Tables &tables, Input &input, QMap<unsigned int, unsigned int> &modified_vertices);
void updateIndexBuffer(QVector<unsigned int> &index_buffer, QMap<unsigned int, unsigned int> map);
......
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