reworked invert()

Mon, 19 Mar 2018 10:59:58 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 19 Mar 2018 10:59:58 +0200
changeset 1303
cb9ee14ab4cf
parent 1302
e14d7826373a
child 1304
bb3f43293cf8

reworked invert()

src/algorithms/invert.cpp file | annotate | diff | comparison | revisions
--- a/src/algorithms/invert.cpp	Mon Mar 19 10:57:19 2018 +0200
+++ b/src/algorithms/invert.cpp	Mon Mar 19 10:59:58 2018 +0200
@@ -91,12 +91,13 @@
 	if (obj->numPolygonVertices() > 0)
 	{
 		QVector<Vertex> vertices;
-
-		for (int i = 0; i < obj->numPolygonVertices(); i += 1)
-			vertices.append(obj->vertex(i));
+		vertices.resize(obj->numPolygonVertices());
 
 		for (int i = 0; i < vertices.size(); i += 1)
-			obj->setVertex(i, vertices[vertices.size() - 1 - i]);
+			vertices[vertices.size() - 1 - i] = obj->vertex(i);
+
+		for (int i = 0; i < vertices.size(); i += 1)
+			obj->setVertex(i, vertices[i]);
 	}
 	else if (obj->type() == LDObjectType::SubfileReference)
 	{

mercurial