mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 14:55:52 +08:00
replace some other dubious algo for comparing surface_type (Surface collection::filter_by_type)
This commit is contained in:
parent
5d1e01839c
commit
7fa4d16b50
@ -93,24 +93,26 @@ template bool SurfaceCollection::any_bottom_contains<Polyline>(const Polyline &i
|
||||
SurfacesPtr
|
||||
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types)
|
||||
{
|
||||
size_t n {0};
|
||||
for (const auto& t : types)
|
||||
n |= t;
|
||||
SurfacesPtr ss;
|
||||
for (auto& s : this->surfaces)
|
||||
if ((s.surface_type & n) == s.surface_type) ss.push_back(&s);
|
||||
for (Surface& s : this->surfaces)
|
||||
for (const SurfaceType& t : types)
|
||||
if (s.surface_type == t) {
|
||||
ss.push_back(&s);
|
||||
break;
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
SurfacesConstPtr
|
||||
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types) const
|
||||
{
|
||||
size_t n {0};
|
||||
for (const auto& t : types)
|
||||
n |= t;
|
||||
SurfacesConstPtr ss;
|
||||
for (auto& s : this->surfaces)
|
||||
if ((s.surface_type & n) == s.surface_type) ss.push_back(&s);
|
||||
for (Surface& s : this->surfaces)
|
||||
for (const SurfaceType& t : types)
|
||||
if (s.surface_type == t) {
|
||||
ss.push_back(&s);
|
||||
break;
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user