diff --git a/src/ViewportWidget.cpp b/src/ViewportWidget.cpp index 28430b3..9f74c09 100644 --- a/src/ViewportWidget.cpp +++ b/src/ViewportWidget.cpp @@ -410,6 +410,8 @@ void ViewportWidget::paintGL() float arcArrowLength = 0.02f * -m_camera->zoom(); float arcArrowWidth = 0.005f * -m_camera->zoom(); + double sign = (angleDiff >= 0) ? 1.0 : -1.0; + // End arrowhead QVector3D endPoint(vertices[vertices.size()-3], vertices[vertices.size()-2], vertices[vertices.size()-1]); double endAngle = lineAngle; @@ -424,7 +426,7 @@ void ViewportWidget::paintGL() radialDir_end = QVector3D(0, cos(endAngle), sin(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_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(); @@ -444,7 +446,7 @@ void ViewportWidget::paintGL() radialDir_start = QVector3D(0, cos(startAngle), sin(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_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();