Parallelized PrintObject::bridge_over_infill() (#2132)

Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
This commit is contained in:
Noisyfox 2023-09-17 11:22:11 +08:00 committed by GitHub
parent bd13d83385
commit 685e058c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 40 deletions

View file

@ -65,7 +65,7 @@ SurfacesPtr SurfaceCollection::filter_by_types(const SurfaceType *types, int nty
return ss;
}
void SurfaceCollection::filter_by_type(SurfaceType type, Polygons* polygons)
void SurfaceCollection::filter_by_type(SurfaceType type, Polygons* polygons) const
{
for (const Surface &surface : this->surfaces)
if (surface.surface_type == type)
@ -121,6 +121,22 @@ void SurfaceCollection::remove_type(const SurfaceType type)
surfaces.erase(surfaces.begin() + j, surfaces.end());
}
void SurfaceCollection::remove_type(const SurfaceType type, ExPolygons *polygons)
{
size_t j = 0;
for (size_t i = 0; i < surfaces.size(); ++ i) {
if (Surface &surface = surfaces[i]; surface.surface_type == type) {
polygons->emplace_back(std::move(surface.expolygon));
} else {
if (j < i)
std::swap(surfaces[i], surfaces[j]);
++ j;
}
}
if (j < surfaces.size())
surfaces.erase(surfaces.begin() + j, surfaces.end());
}
void SurfaceCollection::remove_types(const SurfaceType *types, int ntypes)
{
size_t j = 0;