mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-03 22:20:39 +08:00
Pushed a contains() method up to ExPolygonCollection that returns if any of its expolygons contain the point.
This commit is contained in:
parent
7c513fe0d2
commit
21da567d43
@ -140,5 +140,12 @@ ExPolygonCollection::append(const ExPolygon &expp)
|
||||
{
|
||||
this->expolygons.push_back(expp);
|
||||
}
|
||||
bool
|
||||
ExPolygonCollection::contains(const Point &point) const {
|
||||
for (const auto& poly : this->expolygons) {
|
||||
if (poly.contour.contains(point)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,11 @@ class ExPolygonCollection
|
||||
Polygons holes() const;
|
||||
void append(const ExPolygons &expolygons);
|
||||
void append(const ExPolygon &expolygons);
|
||||
|
||||
/// Convenience function to iterate through all of the owned
|
||||
/// ExPolygons and check if at least one contains the point.
|
||||
bool contains(const Point &point) const;
|
||||
|
||||
};
|
||||
|
||||
inline ExPolygonCollection&
|
||||
|
Loading…
x
Reference in New Issue
Block a user