Fix removing last duplicate point.

If removeFirstAndLast not active the last point must remain intact.
This commit is contained in:
Roman Telezhynskyi 2021-04-07 20:41:57 +03:00
parent 56ae4a1381
commit 5fcefc0642

View file

@ -246,14 +246,15 @@ QVector<T> VAbstractPiece::RemoveDublicates(const QVector<T> &points, bool remov
{
if (VFuzzyComparePoints(p.at(i), p.at(i+1)))
{
if (not removeFirstAndLast && (i == p.size()-1))
if (not removeFirstAndLast && (i == p.size()-2))
{
continue;
p.erase(p.begin() + i);
}
else
{
p.erase(p.begin() + i + 1);
}
p.erase(p.begin() + i + 1);
--i;
continue;
}
}