Commit 2aba8a8a by Philipp Adolf

Extract code into removeVertex

parent a8bc7b1f
...@@ -1073,17 +1073,23 @@ QVector<Vertex> Subdivision::getAllVertices(const QVector<Triangle> &triangles) ...@@ -1073,17 +1073,23 @@ QVector<Vertex> Subdivision::getAllVertices(const QVector<Triangle> &triangles)
return result; return result;
} }
QVector3D Subdivision::updateIrregularVertexForDraw(Vertex currentCorner, QVector<Triangle> neighboring_triangles) { bool removeVertex(QVector<Vertex> &vertices, const Vertex &vertex) {
QVector<Vertex> surroundingVertex; QMutableVectorIterator<Vertex> i(vertices);
surroundingVertex = getAllVertices(neighboring_triangles);
QMutableVectorIterator<Vertex> i(surroundingVertex);
while (i.hasNext()) { while (i.hasNext()) {
if (currentCorner.samePos(i.next())) { if (vertex.samePos(i.next())) {
i.remove(); i.remove();
break; return true;
} }
} }
return false;
}
QVector3D Subdivision::updateIrregularVertexForDraw(Vertex currentCorner, QVector<Triangle> neighboring_triangles) {
QVector<Vertex> surroundingVertex;
surroundingVertex = getAllVertices(neighboring_triangles);
bool removed = removeVertex(surroundingVertex, currentCorner);
assert(removed);
QVector3D newPos(0.0, 0.0, 0.0); QVector3D newPos(0.0, 0.0, 0.0);
......
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