Pushed a contains() method up to ExPolygonCollection that returns if any of its expolygons contain the point.

This commit is contained in:
Joseph Lenox 2018-05-08 23:11:02 -05:00 committed by Joseph Lenox
parent 7c513fe0d2
commit 21da567d43
2 changed files with 12 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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&