From 6590742f0943ceb2bb27e8299b9fec4d90489353 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 May 2019 17:07:18 +0300 Subject: [PATCH] Improve "Remove point on line". Now it should handle circular shapes. --HG-- branch : develop --- src/libs/vlayout/vabstractpiece.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index af104b03f..eb7dee9ca 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -318,14 +318,10 @@ QVector VAbstractPiece::CorrectEquidistantPoints(const QVector &points, bo // Unfortunatelly QLineF::intersect can't be used in this case because of the floating-point accuraccy problem. if (prev == -1) { - i == 0 ? prev = buf1.size() - 1 : prev = i-1; + prev = (i == 0) ? buf1.size() - 1 : i-1; } - int next = i+1; - if (i == buf1.size() - 1) - { - next = 0; - } + const int next = (i == buf1.size() - 1) ? 0 : i+1; const T &iPoint = buf1.at(i); const T &prevPoint = buf1.at(prev);