src/linetypes/triangle.cpp

changeset 33
4c41bfe2ec6e
parent 26
3a9e761e4faa
child 35
98906a94732f
--- a/src/linetypes/triangle.cpp	Sun Jan 26 01:06:27 2020 +0200
+++ b/src/linetypes/triangle.cpp	Sun Jan 26 14:29:30 2020 +0200
@@ -1,16 +1,16 @@
 #include "triangle.h"
 
 linetypes::Triangle::Triangle(
-	const Point3D& point_1,
-	const Point3D& point_2,
-	const Point3D& point_3,
+	const glm::vec3& point_1,
+	const glm::vec3& point_2,
+	const glm::vec3& point_3,
 	Color color_index) :
 	ColoredObject{color_index},
 	points{point_1, point_2, point_3}
 {
 }
 
-linetypes::Triangle::Triangle(const QVector<Point3D>& vertices, const Color color) :
+linetypes::Triangle::Triangle(const QVector<glm::vec3>& vertices, const Color color) :
 	ColoredObject{color},
 	points{vertices[0], vertices[1], vertices[2]}
 {
@@ -21,11 +21,11 @@
 	switch (id)
 	{
 	case Property::Point1:
-		return points[0];
+		return QVariant::fromValue(points[0]);
 	case Property::Point2:
-		return points[1];
+		return QVariant::fromValue(points[1]);
 	case Property::Point3:
-		return points[2];
+		return QVariant::fromValue(points[2]);
 	default:
 		return ColoredObject::getProperty(id);
 	}
@@ -37,13 +37,13 @@
 	switch (id)
 	{
 	case Property::Point1:
-		points[0] = value.value<Point3D>();
+		points[0] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	case Property::Point2:
-		points[1] = value.value<Point3D>();
+		points[1] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	case Property::Point3:
-		points[2] = value.value<Point3D>();
+		points[2] = value.value<glm::vec3>();
 		return SetPropertyResult::Success;
 	default:
 		return ColoredObject::setProperty(id, value);
@@ -53,9 +53,9 @@
 QString linetypes::Triangle::textRepresentation() const
 {
 	return utility::format("%1 %2 %3",
-		vertexToStringParens(points[0]),
-		vertexToStringParens(points[1]),
-		vertexToStringParens(points[2]));
+		utility::vertexToStringParens(points[0]),
+		utility::vertexToStringParens(points[1]),
+		utility::vertexToStringParens(points[2]));
 }
 
 void linetypes::Triangle::getPolygons(

mercurial