new function remove_degenerate(Polylines ...)
This commit is contained in:
parent
c46b6ca27e
commit
40eaf144f0
@ -237,6 +237,23 @@ BoundingBox get_extents(const Polylines &polylines)
|
||||
return bb;
|
||||
}
|
||||
|
||||
bool remove_degenerate(Polylines &polylines)
|
||||
{
|
||||
bool modified = false;
|
||||
size_t j = 0;
|
||||
for (size_t i = 0; i < polylines.size(); ++ i) {
|
||||
if (polylines[i].points.size() >= 2) {
|
||||
if (j < i)
|
||||
std::swap(polylines[i].points, polylines[j].points);
|
||||
++ j;
|
||||
} else
|
||||
modified = true;
|
||||
}
|
||||
if (j < polylines.size())
|
||||
polylines.erase(polylines.begin() + j, polylines.end());
|
||||
return modified;
|
||||
}
|
||||
|
||||
ThickLines
|
||||
ThickPolyline::thicklines() const
|
||||
{
|
||||
|
@ -111,6 +111,8 @@ inline void polylines_append(Polylines &dst, Polylines &&src)
|
||||
}
|
||||
}
|
||||
|
||||
bool remove_degenerate(Polylines &polylines);
|
||||
|
||||
class ThickPolyline : public Polyline {
|
||||
public:
|
||||
std::vector<coordf_t> width;
|
||||
|
Loading…
Reference in New Issue
Block a user