Improve "Remove point on line".

Now it should handle circular shapes.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-27 17:07:18 +03:00
parent d58b3f523d
commit 6590742f09

View File

@ -318,14 +318,10 @@ QVector<T> VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, bo
// Unfortunatelly QLineF::intersect can't be used in this case because of the floating-point accuraccy problem. // Unfortunatelly QLineF::intersect can't be used in this case because of the floating-point accuraccy problem.
if (prev == -1) if (prev == -1)
{ {
i == 0 ? prev = buf1.size() - 1 : prev = i-1; prev = (i == 0) ? buf1.size() - 1 : i-1;
} }
int next = i+1; const int next = (i == buf1.size() - 1) ? 0 : i+1;
if (i == buf1.size() - 1)
{
next = 0;
}
const T &iPoint = buf1.at(i); const T &iPoint = buf1.at(i);
const T &prevPoint = buf1.at(prev); const T &prevPoint = buf1.at(prev);