src/ui/canvas.cpp

changeset 201
5d201ee4a9c3
parent 200
ca23936b455b
child 205
1a4342d80de7
--- a/src/ui/canvas.cpp	Mon Jun 06 22:01:22 2022 +0300
+++ b/src/ui/canvas.cpp	Tue Jun 07 01:37:26 2022 +0300
@@ -234,21 +234,21 @@
 	//font.setStyle(QFont::StyleItalic);
 	painter.setFont(font);
 	QFontMetrics fontMetrics{font};
-	const auto renderText = [&](const QString& text, const geom::PointOnRectagle& intersection)
+	const auto renderText = [&](const QString& text, const PointOnRectagle& intersection)
 	{
 		QPointF position = toQPointF(intersection.position);
-		const geom::RectangleSide side = intersection.side;
+		const RectangleSide side = intersection.side;
 		switch (side)
 		{
-		case geom::RectangleSide::Top:
+		case RectangleSide::Top:
 			position += QPointF{0, static_cast<qreal>(fontMetrics.ascent())};
 			break;
-		case geom::RectangleSide::Left:
+		case RectangleSide::Left:
 			break;
-		case geom::RectangleSide::Bottom:
+		case RectangleSide::Bottom:
 			position += QPointF{0, static_cast<qreal>(-fontMetrics.descent())};
 			break;
-		case geom::RectangleSide::Right:
+		case RectangleSide::Right:
 			position += QPointF{static_cast<qreal>(-fontMetrics.horizontalAdvance(text)), 0};
 			break;
 		}
@@ -272,8 +272,8 @@
 	for (const auto& axis : directions)
 	{
 		const QPointF x_p = this->modelToScreenCoordinates(axis.direction);
-		const auto intersection = geom::rayRectangleIntersection(
-			geom::rayFromPoints(toVec2(p1), toVec2(x_p)),
+		const auto intersection = rayRectangleIntersection(
+			rayFromPoints(toVec2(p1), toVec2(x_p)),
 			box);
 		if (intersection.has_value())
 		{
@@ -304,7 +304,7 @@
 
 Winding Canvas::worldPolygonWinding(const std::vector<glm::vec3> &points) const
 {
-	return geom::winding(QPolygonF{this->convertWorldPointsToScreenPoints(points)});
+	return winding(QPolygonF{this->convertWorldPointsToScreenPoints(points)});
 }
 
 /**
@@ -356,7 +356,7 @@
 void Canvas::drawWorldPoint(QPainter* painter, const glm::vec3& worldPoint) const
 {
 	const QPointF center = this->modelToScreenCoordinates(worldPoint);
-	painter->drawEllipse(geom::inscribe(geom::CircleF{center, 5}));
+	painter->drawEllipse(inscribe(CircleF{center, 5}));
 }
 
 /**
@@ -366,12 +366,12 @@
 void Canvas::setGridMatrix(const glm::mat4& newMatrix)
 {
 	this->gridMatrix = newMatrix;
-	const geom::Triangle triangle {
+	const Triangle triangle {
 		this->gridMatrix * glm::vec4{0, 0, 0, 1},
 		this->gridMatrix * glm::vec4{1, 0, 0, 1},
 		this->gridMatrix * glm::vec4{0, 1, 0, 1},
 	};
-	this->gridPlane = geom::planeFromTriangle(triangle);
+	this->gridPlane = planeFromTriangle(triangle);
 	this->gridProgram->setGridMatrix(this->gridMatrix);
 	this->update();
 }

mercurial