fix: Ensure angle dimension arrows always point outward

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-16 19:24:01 -07:00
parent 1fb211cc34
commit 2f7d2a4189

View File

@@ -410,6 +410,8 @@ void ViewportWidget::paintGL()
float arcArrowLength = 0.02f * -m_camera->zoom(); float arcArrowLength = 0.02f * -m_camera->zoom();
float arcArrowWidth = 0.005f * -m_camera->zoom(); float arcArrowWidth = 0.005f * -m_camera->zoom();
double sign = (angleDiff >= 0) ? 1.0 : -1.0;
// End arrowhead // End arrowhead
QVector3D endPoint(vertices[vertices.size()-3], vertices[vertices.size()-2], vertices[vertices.size()-1]); QVector3D endPoint(vertices[vertices.size()-3], vertices[vertices.size()-2], vertices[vertices.size()-1]);
double endAngle = lineAngle; double endAngle = lineAngle;
@@ -424,7 +426,7 @@ void ViewportWidget::paintGL()
radialDir_end = QVector3D(0, cos(endAngle), sin(endAngle)); radialDir_end = QVector3D(0, cos(endAngle), sin(endAngle));
tangentDir_end = QVector3D(0, -sin(endAngle), cos(endAngle)); tangentDir_end = QVector3D(0, -sin(endAngle), cos(endAngle));
} }
QVector3D arc_arrow_base_end = endPoint - arcArrowLength * tangentDir_end; QVector3D arc_arrow_base_end = endPoint - sign * arcArrowLength * tangentDir_end;
QVector3D arc_arrowP1_end = arc_arrow_base_end + arcArrowWidth * radialDir_end; QVector3D arc_arrowP1_end = arc_arrow_base_end + arcArrowWidth * radialDir_end;
QVector3D arc_arrowP2_end = arc_arrow_base_end - arcArrowWidth * radialDir_end; QVector3D arc_arrowP2_end = arc_arrow_base_end - arcArrowWidth * radialDir_end;
arrowVertices << endPoint.x() << endPoint.y() << endPoint.z() << arc_arrowP1_end.x() << arc_arrowP1_end.y() << arc_arrowP1_end.z(); arrowVertices << endPoint.x() << endPoint.y() << endPoint.z() << arc_arrowP1_end.x() << arc_arrowP1_end.y() << arc_arrowP1_end.z();
@@ -444,7 +446,7 @@ void ViewportWidget::paintGL()
radialDir_start = QVector3D(0, cos(startAngle), sin(startAngle)); radialDir_start = QVector3D(0, cos(startAngle), sin(startAngle));
tangentDir_start = QVector3D(0, -sin(startAngle), cos(startAngle)); tangentDir_start = QVector3D(0, -sin(startAngle), cos(startAngle));
} }
QVector3D arc_arrow_base_start = startPoint + arcArrowLength * tangentDir_start; QVector3D arc_arrow_base_start = startPoint + sign * arcArrowLength * tangentDir_start;
QVector3D arc_arrowP1_start = arc_arrow_base_start + arcArrowWidth * radialDir_start; QVector3D arc_arrowP1_start = arc_arrow_base_start + arcArrowWidth * radialDir_start;
QVector3D arc_arrowP2_start = arc_arrow_base_start - arcArrowWidth * radialDir_start; QVector3D arc_arrowP2_start = arc_arrow_base_start - arcArrowWidth * radialDir_start;
arrowVertices << startPoint.x() << startPoint.y() << startPoint.z() << arc_arrowP1_start.x() << arc_arrowP1_start.y() << arc_arrowP1_start.z(); arrowVertices << startPoint.x() << startPoint.y() << startPoint.z() << arc_arrowP1_start.x() << arc_arrowP1_start.y() << arc_arrowP1_start.z();