src/linetypes/circularprimitive.cpp

changeset 1403
7a2d84112983
parent 1402
8bbf2af8c3f5
child 1406
37fffb682d2f
--- a/src/linetypes/circularprimitive.cpp	Sun Jun 10 23:25:08 2018 +0300
+++ b/src/linetypes/circularprimitive.cpp	Sun Jun 17 13:53:33 2018 +0300
@@ -27,14 +27,11 @@
 	return format("%1%2-%3%4.dat", prefix, numerator, denominator, stem());
 }
 
-LDCircularPrimitive::LDCircularPrimitive(
-	PrimitiveModel::Type type,
+LDCircularPrimitive::LDCircularPrimitive(PrimitiveModel::Type type,
 	int segments,
 	int divisions,
-	const Matrix& transformationMatrix,
-	const Vertex& position
-) :
-	LDMatrixObject {transformationMatrix, position},
+	const QMatrix4x4& matrix) :
+	LDMatrixObject {matrix},
 	m_type {type},
 	m_segments {segments},
 	m_divisions {divisions} {}
@@ -46,7 +43,7 @@
 
 QString LDCircularPrimitive::asText() const
 {
-	return LDSubfileReference(buildFilename(), transformationMatrix(), position()).asText();
+	return LDSubfileReference(buildFilename(), transformationMatrix()).asText();
 }
 
 void LDCircularPrimitive::getVertices(DocumentManager* /* context */, QSet<Vertex>& vertices) const
@@ -60,7 +57,7 @@
 		for (double y_value : {0.0, 1.0})
 		{
 			Vertex vertex {point2d.x(), y_value, point2d.y()};
-			vertex.transform(transformationMatrix(), position());
+			vertex.transform(transformationMatrix());
 			vertices.insert(vertex);
 		}
 	}
@@ -86,7 +83,7 @@
 		for (int i = 0; i < object->numVertices(); i += 1)
 		{
 			Vertex vertex = object->vertex(i);
-			vertex.transform(transformationMatrix(), position());
+			vertex.transform(transformationMatrix());
 			object->setVertex(i, vertex);
 		}
 	}
@@ -106,7 +103,7 @@
 		for (int i = 0; i < object->numVertices(); i += 1)
 		{
 			Vertex vertex = object->vertex(i);
-			vertex.transform(transformationMatrix(), position());
+			vertex.transform(transformationMatrix());
 			object->setVertex(i, vertex);
 		}
 
@@ -174,8 +171,9 @@
 		position().toString(true)
 	).simplified();
 
-	for (int i = 0; i < 9; ++i)
-		result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : "");
+	for (int i = 0; i < 3; ++i)
+	for (int j = 0; j < 3; ++j)
+		result += format("%1%2", transformationMatrix()(i, j), (i != 2 or j != 2) ? " " : "");
 
 	result += ')';
 	return result;

mercurial