From 471e7f2d9c9e1e8e32876975250c0eac784a7fda Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Wed, 18 Feb 2026 15:48:56 -0700 Subject: [PATCH] fix: Align sketch grid with Z-up coordinate system Co-authored-by: aider (gemini/gemini-2.5-pro) --- src/SketchGrid.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/SketchGrid.cpp b/src/SketchGrid.cpp index b3a8924..8b8dae9 100644 --- a/src/SketchGrid.cpp +++ b/src/SketchGrid.cpp @@ -87,11 +87,11 @@ void SketchGrid::drawGridLines(SketchPlane plane, QOpenGLShaderProgram* shaderPr float pos = i * minorIncrement; QVector& current_vector = (i % 5 == 0) ? majorLines : minorLines; if (plane == XY) { - current_vector << pos << 0 << -gridSize << pos << 0 << gridSize; - current_vector << -gridSize << 0 << pos << gridSize << 0 << pos; - } else if (plane == XZ) { current_vector << pos << -gridSize << 0 << pos << gridSize << 0; current_vector << -gridSize << pos << 0 << gridSize << pos << 0; + } else if (plane == XZ) { + current_vector << pos << 0 << -gridSize << pos << 0 << gridSize; + current_vector << -gridSize << 0 << pos << gridSize << 0 << pos; } else { // YZ current_vector << 0 << pos << -gridSize << 0 << pos << gridSize; current_vector << 0 << -gridSize << pos << 0 << gridSize << pos; @@ -133,7 +133,7 @@ void SketchGrid::drawAxes(SketchPlane plane, QOpenGLShaderProgram* shaderProgram // Y Axis (Green) if (plane == XY || plane == YZ) { vertices.clear(); - vertices << 0 << 0 << -axisLength << 0 << 0 << axisLength; + vertices << 0 << -axisLength << 0 << 0 << axisLength << 0; shaderProgram->setUniformValue(colorLoc, QVector4D(0.0f, 1.0f, 0.0f, 1.0f)); m_vbo.allocate(vertices.constData(), vertices.size() * sizeof(GLfloat)); glDrawArrays(GL_LINES, 0, 2); @@ -141,7 +141,7 @@ void SketchGrid::drawAxes(SketchPlane plane, QOpenGLShaderProgram* shaderProgram // Z Axis (Blue) if (plane == XZ || plane == YZ) { vertices.clear(); - vertices << 0 << -axisLength << 0 << 0 << axisLength << 0; + vertices << 0 << 0 << -axisLength << 0 << 0 << axisLength; shaderProgram->setUniformValue(colorLoc, QVector4D(0.0f, 0.0f, 1.0f, 1.0f)); m_vbo.allocate(vertices.constData(), vertices.size() * sizeof(GLfloat)); glDrawArrays(GL_LINES, 0, 2); @@ -184,10 +184,10 @@ void SketchGrid::paintAxisLabels(QPainter& painter, SketchGrid::SketchPlane plan if (plane == SketchGrid::XY) { drawLabelsForAxis(0); // X - drawLabelsForAxis(2); // Y + drawLabelsForAxis(1); // Y } else if (plane == SketchGrid::XZ) { drawLabelsForAxis(0); // X - drawLabelsForAxis(1); // Z + drawLabelsForAxis(2); // Z } else if (plane == SketchGrid::YZ) { drawLabelsForAxis(1); // Y drawLabelsForAxis(2); // Z