mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 21:45:57 +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
|
SurfacesPtr
|
||||||
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types)
|
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types)
|
||||||
{
|
{
|
||||||
size_t n {0};
|
|
||||||
for (const auto& t : types)
|
|
||||||
n |= t;
|
|
||||||
SurfacesPtr ss;
|
SurfacesPtr ss;
|
||||||
for (auto& s : this->surfaces)
|
for (Surface& s : this->surfaces)
|
||||||
if ((s.surface_type & n) == s.surface_type) ss.push_back(&s);
|
for (const SurfaceType& t : types)
|
||||||
|
if (s.surface_type == t) {
|
||||||
|
ss.push_back(&s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfacesConstPtr
|
SurfacesConstPtr
|
||||||
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types) const
|
SurfaceCollection::filter_by_type(std::initializer_list<SurfaceType> types) const
|
||||||
{
|
{
|
||||||
size_t n {0};
|
|
||||||
for (const auto& t : types)
|
|
||||||
n |= t;
|
|
||||||
SurfacesConstPtr ss;
|
SurfacesConstPtr ss;
|
||||||
for (auto& s : this->surfaces)
|
for (Surface& s : this->surfaces)
|
||||||
if ((s.surface_type & n) == s.surface_type) ss.push_back(&s);
|
for (const SurfaceType& t : types)
|
||||||
|
if (s.surface_type == t) {
|
||||||
|
ss.push_back(&s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user